Skip to content

Commit

Permalink
Use Result#non_zero_exit_status? in the JUnit Formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
brasmusson committed May 31, 2015
1 parent fd5e38e commit 085c58f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/cucumber/formatter/junit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def before_test_case(test_case)
def after_test_step(test_step, result)
return if @failing_step_source

@failing_step_source = test_step.source.last if result.failed? || (@options[:strict] && (result.pending? || result.undefined?))
@failing_step_source = test_step.source.last if result.non_zero_exit_status?(@options[:strict])
end

def after_test_case(test_case, result)
Expand Down Expand Up @@ -86,7 +86,7 @@ def end_feature

def create_output_string(test_case, scenario, result, row_name)
output = "#{test_case.keyword}: #{scenario}\n\n"
return output unless result.failed? || (@options[:strict] && (result.pending? || result.undefined?))
return output unless result.non_zero_exit_status?(@options[:strict])
if test_case.keyword == "Scenario"
output += "#{@failing_step_source.keyword}" unless hook?(@failing_step_source)
output += "#{@failing_step_source.name}\n"
Expand All @@ -105,10 +105,9 @@ def build_testcase(result, scenario_designation, output)
@time += duration
classname = @current_feature.name
name = scenario_designation
pending = (result.pending? || result.undefined?) && (!@options[:strict])

@builder.testcase(:classname => classname, :name => name, :time => "%.6f" % duration) do
if result.skipped? || pending
if !result.passed? && !result.non_zero_exit_status?(@options[:strict])
@builder.skipped
@skipped += 1
elsif !result.passed?
Expand Down

0 comments on commit 085c58f

Please sign in to comment.