Skip to content

Commit

Permalink
Fixed cucumber#520: fix incorrect html formatter behaviour when backg…
Browse files Browse the repository at this point in the history
…round step fails

When encountering a failure in a background step, the html formatter
incorrectly marked the previous scenario red. With this fix, the html
formatter now correctly marks the current background red and does not
touch the output of the previous scenario anymore.
  • Loading branch information
mlex committed Aug 16, 2013
1 parent 4951753 commit 82ea84f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cucumber/formatter/html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,17 @@ def set_scenario_color_failed
@builder.script do
@builder.text!("makeRed('cucumber-header');") unless @header_red
@header_red = true
@builder.text!("makeRed('scenario_#{@scenario_number}');") unless @scenario_red
scenario_or_background = @in_background ? "background" : "scenario"
@builder.text!("makeRed('#{scenario_or_background}_#{@scenario_number}');") unless @scenario_red
@scenario_red = true
end
end

def set_scenario_color_pending
@builder.script do
@builder.text!("makeYellow('cucumber-header');") unless @header_red
@builder.text!("makeYellow('scenario_#{@scenario_number}');") unless @scenario_red
scenario_or_background = @in_background ? "background" : "scenario"
@builder.text!("makeYellow('#{scenario_or_background}_#{@scenario_number}');") unless @scenario_red
end
end

Expand Down

0 comments on commit 82ea84f

Please sign in to comment.