Displaying a note or comment when --format doc

I’m new to rspec, so, I might be coloring outside the lines, but,
there have been several instances where I have wanted to display a
comment or note.

for example:

describe “truck” do
it “should require model” do
end
end

rspec spec --format doc

truck
should require model

What I mean by display a comment or note would be like:

truck
NOTE: blah, blah, blah…
should require model

Currently, I’m accomplishing this goal by using a describe with an
empty block. Maybe I’m breaking some rules here, but, it just made
sense to display a note given the particular spec I’m working on.

Is there a way to accomplish the same thing other than using a
describe with an empty block??

On Dec 8, 2010, at 10:39 PM, rails.impaired wrote:

Currently, I’m accomplishing this goal by using a describe with an
empty block. Maybe I’m breaking some rules here, but, it just made
sense to display a note given the particular spec I’m working on.

Is there a way to accomplish the same thing other than using a
describe with an empty block??

There is no direct support for comments outside the documentation
strings passed to describe() and it(), but you could use a “here doc”:

describe “truck” do
it(<<-DOCSTRING) do
NOTE: blah, blah, blah
should require model
DOCSTRING

end
end

I probably wouldn’t do this as it trades off readability in the spec for
readability on the command line, but it would get you what you need.

Cheers,
David