spec/cuukie_spec.rb in cuukie-0.1.3 vs spec/cuukie_spec.rb in cuukie-0.1.4

- old
+ new

@@ -2,44 +2,21 @@ describe 'Cuukie' do before(:all) { start_server } after(:all) { stop_server_on_port 4569 } - describe 'shows suite result at the top of the page' do - it "contains essential information" do - run_cucumber - html.should match '<h1>Cucumber Features</h1>' - html.should match '<title>Cuukie</title>' - end - - it "shows green if all scenarios passed" do - run_cucumber '1_show_scenarios.feature:9' - html.should match /passedColors\('cucumber-header'\)/ - end - - it "shows red if any scenario failed" do - run_cucumber '1_show_scenarios.feature' - html.should match /failedColors\('cucumber-header'\)/ - end - - it "shows yellow if no scenarios failed but some are pending" do - run_cucumber '1_show_scenarios.feature:19' - html.should match /pendingColors\('cucumber-header'\)/ - end - end - describe 'in the content area' do before(:all) { run_cucumber } it "cleans up previous data at the beginning of a run" do run_cucumber html.scan('Feature: Visualize Scenarios').size.should == 1 end it "shows the feature names" do html.should match '>Feature: Visualize Scenarios<' - html.should match '>Feature: Multiple Features<' + html.should match '>Feature: Show Failed Background<' end it "shows the feature narratives" do html.should match '>As a Cuker<br/>I want to visualize Scenarios and Steps<br/>So that I know which steps are not passing<bbr/r><' end @@ -75,18 +52,36 @@ html.should match '>And </span><span class="step val">I do something</span>' html.should match '>When </span><span class="step val">I do something else</span>' end it "shows the step source position" do - html.should match '>features&#x2F;step_definitions&#x2F;example_steps.rb:' + html.should match '>features&#x2F;step_definitions&#x2F;main_steps.rb:' end it "shows the step status" do html.should match 'class="step passed"' html.should match 'class="step pending"' end - + + it "shows exception messages" do + html.should match /main_steps.rb:7<\/span><\/div>[ \n]*<div class="message"><pre>Crash!<\/pre><\/div>/ + end + + it "shows exception backtraces" do + html.should match 'backtrace"><pre>.&#x2F;features&#x2F;step_definitions&#x2F;main_steps.rb:8:in `&#x2F;I do' + html.should match '3_failed_background.feature:7:in `Given I do' + end + + it "shows exception source snippets" do + html.should match '<pre class="ruby"><code><span class="linenum">6<\/span>' + html.should match '<span class="constant">I</span> <span class="keyword">do</span> <span class="ident">something' + end + + it "marks the exception source in snippets" do + html.should match '<span class="offending"><span class="linenum">8<\/span> <span class=\"keyword\">raise' + end + it "escapes HTML output" do html.should match 'I pass an &quot;argument&quot;' end it "shows tables in steps" do @@ -104,8 +99,31 @@ it "shows end-of-features stats" do run_cucumber '1_show_scenarios.feature' html.should match /3 scenarios \(1 failed, 1 pending, 1 passed\)/ html.should match /11 steps \(1 failed, 2 skipped, 1 pending, 7 passed\)/ + end + end + + describe 'in the page header' do + it "contains essential information" do + run_cucumber + html.should match '<h1>Cucumber Features</h1>' + html.should match '<title>Cuukie</title>' + end + + it "shows green if all scenarios passed" do + run_cucumber '1_show_scenarios.feature:9' + html.should match /passedColors\('cucumber-header'\)/ + end + + it "shows red if any scenario failed" do + run_cucumber '1_show_scenarios.feature' + html.should match /failedColors\('cucumber-header'\)/ + end + + it "shows yellow if no scenarios failed but some are pending" do + run_cucumber '1_show_scenarios.feature:19' + html.should match /pendingColors\('cucumber-header'\)/ end end end