Class: Cucumber::Formatter::Fuubar
- Inherits:
-
Object
- Object
- Cucumber::Formatter::Fuubar
- Includes:
- Console, Io
- Defined in:
- lib/cucumber/formatter/fuubar.rb
Instance Attribute Summary collapse
-
#runtime ⇒ Object
(also: #step_mother)
readonly
Returns the value of attribute runtime.
Instance Method Summary collapse
- #after_background(background) ⇒ Object
- #after_examples(examples) ⇒ Object
- #after_features(features) ⇒ Object
- #after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line) ⇒ Object
- #after_table_row(table_row) ⇒ Object
- #before_background(background) ⇒ Object
- #before_examples(examples) ⇒ Object
- #before_features(features) ⇒ Object
- #before_table_row(table_row) ⇒ Object
- #exception(exception, status) ⇒ Object
-
#initialize(runtime, path_or_io, options) ⇒ Fuubar
constructor
A new instance of Fuubar.
Constructor Details
#initialize(runtime, path_or_io, options) ⇒ Fuubar
Returns a new instance of Fuubar.
15 16 17 18 |
# File 'lib/cucumber/formatter/fuubar.rb', line 15 def initialize(runtime, path_or_io, ) @runtime, @io, = runtime, ensure_io(path_or_io, "fuubar"), @step_count = @issues_count = 0 end |
Instance Attribute Details
#runtime ⇒ Object (readonly) Also known as: step_mother
Returns the value of attribute runtime.
12 13 14 |
# File 'lib/cucumber/formatter/fuubar.rb', line 12 def runtime @runtime end |
Instance Method Details
#after_background(background) ⇒ Object
36 37 38 |
# File 'lib/cucumber/formatter/fuubar.rb', line 36 def after_background(background) @in_background = false end |
#after_examples(examples) ⇒ Object
50 51 52 |
# File 'lib/cucumber/formatter/fuubar.rb', line 50 def after_examples(examples) @is_example = false end |
#after_features(features) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/cucumber/formatter/fuubar.rb', line 20 def after_features(features) @state = :red if runtime.scenarios(:failed).any? @io.puts @io.puts print_summary(features) end |
#after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line) ⇒ Object
40 41 42 43 44 |
# File 'lib/cucumber/formatter/fuubar.rb', line 40 def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line) return if @in_background || status == :skipped @state = :red if status == :failed progress(status) end |
#after_table_row(table_row) ⇒ Object
60 61 62 63 64 |
# File 'lib/cucumber/formatter/fuubar.rb', line 60 def after_table_row(table_row) if @is_example && table_row.is_a?(Cucumber::Ast::OutlineTable::ExampleRow) && table_row.scenario_outline progress(:passed, table_row.scenario_outline.instance_variable_get("@steps").count) end end |
#before_background(background) ⇒ Object
32 33 34 |
# File 'lib/cucumber/formatter/fuubar.rb', line 32 def before_background(background) @in_background = true end |
#before_examples(examples) ⇒ Object
46 47 48 |
# File 'lib/cucumber/formatter/fuubar.rb', line 46 def before_examples(examples) @is_example = true end |
#before_features(features) ⇒ Object
27 28 29 30 |
# File 'lib/cucumber/formatter/fuubar.rb', line 27 def before_features(features) @step_count = features.step_count = ProgressBar.create(:format => ' %c/%C |%w>%i| %e ', :total => @step_count, :output => @io) end |
#before_table_row(table_row) ⇒ Object
54 55 56 57 58 |
# File 'lib/cucumber/formatter/fuubar.rb', line 54 def before_table_row(table_row) if @is_example && table_row.is_a?(Cucumber::Ast::OutlineTable::ExampleRow) && table_row.scenario_outline && table_row.scenario_outline.instance_variable_get("@background").instance_variable_get("@steps") progress(:passed, table_row.scenario_outline.instance_variable_get("@background").instance_variable_get("@steps").count) end end |
#exception(exception, status) ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/cucumber/formatter/fuubar.rb', line 66 def exception(exception, status) @io.print "\e[K" if colors_enabled? @issues_count += 1 @io.puts @io.puts "#{@issues_count})" print_exception(exception, status, 2) @io.puts @io.flush end |