Is there any existing tool or command to automatically list every single example in an app?
For example, if I had…
/spec/apple_spec.rb:
describe Apple do
it "should be round" do
@apple.shape.should == "round"
end
it "should be red" do
@apple.colour.should == "red"
do
end
/spec/banana_spec.rb:
describe Banana do
it "should be bent" do
@banana.shape.should == "bent"
end
it "should be yellow" do
@banana.colour.should == "yellow"
end
end
…then the tool or command I’m looking for would yield something like:
apple_spec.rb
- describe apple
- it should be round
- it should be red
banana_spec.rb
- describe banana
- it should be bent
- it should be yellow
Reviewing this output would help me to confirm that I’d tested all the behaviours that were important to me.
Setting
format=documentationwill produce nicely formatted output for all examples, passing and failing. You can do this on the command line:rspec --format=documentationOr add the setting to the
.rspecconfig file in the root of your project.