Class: Cucumber::Formatter::Fuubar

Inherits:
Object
  • Object
show all
Includes:
Console, Io
Defined in:
lib/cucumber/formatter/fuubar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step_mother, path_or_io, options) ⇒ Fuubar

Returns a new instance of Fuubar.



13
14
15
16
# File 'lib/cucumber/formatter/fuubar.rb', line 13

def initialize(step_mother, path_or_io, options)
  @step_mother, @io, @options = step_mother, ensure_io(path_or_io, "fuubar"), options
  @step_count = @finished_count = @issues_count = 0
end

Instance Attribute Details

#step_motherObject (readonly)

Returns the value of attribute step_mother.



11
12
13
# File 'lib/cucumber/formatter/fuubar.rb', line 11

def step_mother
  @step_mother
end

Instance Method Details

#after_background(background) ⇒ Object



37
38
39
# File 'lib/cucumber/formatter/fuubar.rb', line 37

def after_background(background)
  @in_background = false
end

#after_examples(examples) ⇒ Object



60
61
62
# File 'lib/cucumber/formatter/fuubar.rb', line 60

def after_examples(examples)
  @is_example = false
end

#after_features(features) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/cucumber/formatter/fuubar.rb', line 18

def after_features(features)
  @io.print COLORS[state]
  @progress_bar.finish
  @io.print "\e[0m"
  @io.puts
  @io.puts
  print_summary(features)
end

#after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/cucumber/formatter/fuubar.rb', line 41

def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
  return if @in_background || status == :skipped
  @state = :red if status == :failed
  if exception and [:failed, :undefined].include? status
    @io.print "\e[K"
    @issues_count += 1
    @io.puts
    @io.puts "#{@issues_count})"
    print_exception(exception, status, 2)
    @io.puts
    @io.flush
  end
  progress(status)
end

#after_table_row(table_row) ⇒ Object



70
71
72
73
74
# File 'lib/cucumber/formatter/fuubar.rb', line 70

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



33
34
35
# File 'lib/cucumber/formatter/fuubar.rb', line 33

def before_background(background)
  @in_background = true
end

#before_examples(examples) ⇒ Object



56
57
58
# File 'lib/cucumber/formatter/fuubar.rb', line 56

def before_examples(examples)
  @is_example = true
end

#before_features(features) ⇒ Object



27
28
29
30
31
# File 'lib/cucumber/formatter/fuubar.rb', line 27

def before_features(features)
  @step_count = get_step_count(features)
  @progress_bar = ProgressBar.new("  #{@step_count} steps", @step_count, @io)
  @progress_bar.bar_mark = '='
end

#before_table_row(table_row) ⇒ Object



64
65
66
67
68
# File 'lib/cucumber/formatter/fuubar.rb', line 64

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