Class: Specjour::Cucumber::FinalReport

Inherits:
Object
  • Object
show all
Includes:
Cucumber::Formatter::Console
Defined in:
lib/specjour/cucumber/final_report.rb

Instance Method Summary collapse

Constructor Details

#initializeFinalReport

Returns a new instance of FinalReport.



49
50
51
52
53
# File 'lib/specjour/cucumber/final_report.rb', line 49

def initialize
  @io = $stdout
  @features = []
  @summarizer = Summarizer.new
end

Instance Method Details

#add(stats) ⇒ Object



55
56
57
# File 'lib/specjour/cucumber/final_report.rb', line 55

def add(stats)
  @summarizer.add(stats)
end

#exit_statusObject



59
60
61
# File 'lib/specjour/cucumber/final_report.rb', line 59

def exit_status
  @summarizer.failing_scenarios.empty?
end

#summarizeObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/specjour/cucumber/final_report.rb', line 63

def summarize
  if @summarizer.steps(:failed).any?
    puts "\n\n"
    @summarizer.step_summary.each {|f| puts f }
  end

  if @summarizer.failing_scenarios.any?
    puts "\n\n"
    puts format_string("Failing Scenarios:", :failed)
    @summarizer.failing_scenarios.each {|f| puts f }
  end

  default_format = lambda {|status_count, status| format_string(status_count, status)}
  puts
  puts scenario_summary(@summarizer, &default_format)
  puts step_summary(@summarizer, &default_format)
  puts format_duration(@summarizer.duration) if @summarizer.duration
end