Class: Cucumber::Formatters::ProgressFormatter
- Inherits:
-
Object
- Object
- Cucumber::Formatters::ProgressFormatter
- Includes:
- ANSIColor
- Defined in:
- lib/cucumber/formatters/progress_formatter.rb
Direct Known Subclasses
Constant Summary
Constants included from ANSIColor
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(io) ⇒ ProgressFormatter
constructor
A new instance of ProgressFormatter.
- #scenario_executing(scenario) ⇒ Object
- #step_failed(step, regexp, args) ⇒ Object
- #step_passed(step, regexp, args) ⇒ Object
- #step_pending(step, regexp, args) ⇒ Object
- #step_skipped(step, regexp, args) ⇒ Object
Methods included from ANSIColor
Constructor Details
#initialize(io) ⇒ ProgressFormatter
Returns a new instance of ProgressFormatter.
8 9 10 11 12 |
# File 'lib/cucumber/formatters/progress_formatter.rb', line 8 def initialize(io) @io = (io == STDOUT) ? Kernel : io @errors = [] @pending_scenarios = [] end |
Instance Method Details
#dump ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cucumber/formatters/progress_formatter.rb', line 39 def dump @io.puts pending @io.puts "\nPending Scenarios:\n\n" if @pending_scenarios.any? @pending_scenarios.uniq.each_with_index do |scenario, n| @io.puts "#{n+1}) #{scenario.feature.header.split("\n").first.gsub(/^(Feature|Story):/, '')} (#{scenario.name})" end @io.puts failed @io.puts "\nFailed:" if @errors.any? @errors.each_with_index do |error,n| @io.puts @io.puts "#{n+1})" @io.puts error. @io.puts error.backtrace.join("\n") end @io.print reset end |
#scenario_executing(scenario) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/cucumber/formatters/progress_formatter.rb', line 14 def scenario_executing(scenario) if scenario.pending? @pending_scenarios << scenario @io.print pending("P") end end |
#step_failed(step, regexp, args) ⇒ Object
25 26 27 28 |
# File 'lib/cucumber/formatters/progress_formatter.rb', line 25 def step_failed(step, regexp, args) @errors << step.error @io.print failed('F') end |
#step_passed(step, regexp, args) ⇒ Object
21 22 23 |
# File 'lib/cucumber/formatters/progress_formatter.rb', line 21 def step_passed(step, regexp, args) @io.print passed('.') end |
#step_pending(step, regexp, args) ⇒ Object
30 31 32 33 |
# File 'lib/cucumber/formatters/progress_formatter.rb', line 30 def step_pending(step, regexp, args) @pending_scenarios << step.scenario @io.print pending('P') end |
#step_skipped(step, regexp, args) ⇒ Object
35 36 37 |
# File 'lib/cucumber/formatters/progress_formatter.rb', line 35 def step_skipped(step, regexp, args) @io.print skipped('_') end |