Class: Lucid::Formatter::Progress

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

Direct Known Subclasses

Usage

Constant Summary

Constants included from ANSIColor

ANSIColor::ALIASES

Constants included from Term::ANSIColor

Term::ANSIColor::ATTRIBUTES, Term::ANSIColor::ATTRIBUTE_NAMES, Term::ANSIColor::COLORED_REGEXP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Io

#ensure_dir, #ensure_file, #ensure_io

Methods included from Console

#embed, #empty_messages, #format_step, #format_string, #linebreaks, #print_elements, #print_exception, #print_failing_strict, #print_matchers, #print_message, #print_messages, #print_passing_wip, #print_profile_information, #print_stats, #print_steps, #print_table_row_messages, #puts

Methods included from ANSIColor

#cukes, define_grey, define_real_grey, #green_cukes, #grey, #red_cukes, #yellow_cukes

Methods included from Term::ANSIColor

attributes, coloring=, coloring?, included, #uncolored

Methods included from Summary

#scenario_summary, #step_summary

Methods included from Duration

#format_duration

Constructor Details

#initialize(runtime, path_or_io, options) ⇒ Progress

Returns a new instance of Progress.



11
12
13
# File 'lib/lucid/formatter/progress.rb', line 11

def initialize(runtime, path_or_io, options)
  @runtime, @io, @options = runtime, ensure_io(path_or_io, 'progress'), options
end

Instance Attribute Details

#runtimeObject (readonly)

Returns the value of attribute runtime.



9
10
11
# File 'lib/lucid/formatter/progress.rb', line 9

def runtime
  @runtime
end

Instance Method Details

#after_feature_element(*args) ⇒ Object



29
30
31
32
# File 'lib/lucid/formatter/progress.rb', line 29

def after_feature_element(*args)
  progress(:failed) if (defined? @exception_raised) and (@exception_raised)
  @exception_raised = false
end

#after_features(features) ⇒ Object



19
20
21
22
23
# File 'lib/lucid/formatter/progress.rb', line 19

def after_features(features)
  @io.puts
  @io.puts
  print_summary(features)
end

#after_outline_table(outline_table) ⇒ Object



52
53
54
# File 'lib/lucid/formatter/progress.rb', line 52

def after_outline_table(outline_table)
  @outline_table = nil
end

#after_step_result(step_result) ⇒ Object



43
44
45
46
# File 'lib/lucid/formatter/progress.rb', line 43

def after_step_result(step_result)
  progress(step_result.status)
  @status = step_result.status
end

#after_steps(*args) ⇒ Object



39
40
41
# File 'lib/lucid/formatter/progress.rb', line 39

def after_steps(*args)
  @exception_raised = false
end

#before_feature_element(*args) ⇒ Object



25
26
27
# File 'lib/lucid/formatter/progress.rb', line 25

def before_feature_element(*args)
  @exception_raised = false
end

#before_features(features) ⇒ Object



15
16
17
# File 'lib/lucid/formatter/progress.rb', line 15

def before_features(features)
  print_profile_information
end

#before_outline_table(outline_table) ⇒ Object



48
49
50
# File 'lib/lucid/formatter/progress.rb', line 48

def before_outline_table(outline_table)
  @outline_table = outline_table
end

#before_steps(*args) ⇒ Object



34
35
36
37
# File 'lib/lucid/formatter/progress.rb', line 34

def before_steps(*args)
  progress(:failed) if (defined? @exception_raised) and (@exception_raised)
  @exception_raised = false
end

#exception(*args) ⇒ Object



62
63
64
# File 'lib/lucid/formatter/progress.rb', line 62

def exception(*args)
  @exception_raised = true
end

#table_cell_value(value, status) ⇒ Object



56
57
58
59
60
# File 'lib/lucid/formatter/progress.rb', line 56

def table_cell_value(value, status)
  return unless @outline_table
  status ||= @status
  progress(status) unless table_header_cell?(status)
end