vendor/plugins/rspec/spec/spec/runner/formatter/story/html_formatter_spec.rb in spree-0.2.0 vs vendor/plugins/rspec/spec/spec/runner/formatter/story/html_formatter_spec.rb in spree-0.4.0
- old
+ new
@@ -35,16 +35,22 @@
@reporter.run_ended
end
it "should create spans for params" do
@reporter.step_succeeded('given', 'a $coloured $animal', 'brown', 'dog')
- @out.string.should == " <li class=\"passed\">Given a <span class=\"param\">brown</span> <span class=\"param\">dog</span></li>\n"
+ @reporter.scenario_ended
+ @reporter.story_ended('story_title', 'narrative')
+
+ @out.string.should include(" <li class=\"passed\">Given a <span class=\"param\">brown</span> <span class=\"param\">dog</span></li>\n")
end
it 'should create spanes for params in regexp steps' do
@reporter.step_succeeded :given, /a (pink|blue) (.*)/, 'brown', 'dog'
- @out.string.should == " <li class=\"passed\">Given a <span class=\"param\">brown</span> <span class=\"param\">dog</span></li>\n"
+ @reporter.scenario_ended
+ @reporter.story_ended('story_title', 'narrative')
+
+ @out.string.should include(" <li class=\"passed\">Given a <span class=\"param\">brown</span> <span class=\"param\">dog</span></li>\n")
end
it "should create a ul for collected_steps" do
@reporter.collected_steps(['Given a $coloured $animal', 'Given a $n legged eel'])
@out.string.should == (<<-EOF)
@@ -52,9 +58,29 @@
<li>Given a $coloured $animal</li>
<li>Given a $n legged eel</li>
</ul>
EOF
end
+
+ it "should create a failed story if one of its scenarios fails" do
+ @reporter.story_started('story_title', 'narrative')
+ @reporter.scenario_started('story_title', 'succeeded_scenario_name')
+ @reporter.step_failed('then', 'failed_step', 'en', 'to')
+ @reporter.scenario_failed('story_title', 'failed_scenario_name', NameError.new('sup'))
+ @reporter.story_ended('story_title', 'narrative')
+
+ @out.string.should include(" <dl class=\"story failed\">\n <dt>Story: story_title</dt>\n")
+ end
+
+ it "should create a failed scenario if one of its steps fails" do
+ @reporter.scenario_started('story_title', 'failed_scenario_name')
+ @reporter.step_failed('then', 'failed_step', 'en', 'to')
+ @reporter.scenario_failed('story_title', 'failed_scenario_name', NameError.new('sup'))
+ @reporter.story_ended('story_title', 'narrative')
+
+ @out.string.should include("<dl class=\"failed\">\n <dt>Scenario: failed_scenario_name</dt>\n")
+ end
+
end
end
end
end
end
\ No newline at end of file