Class: Cucumber::Formatter::SimpleDoc
- Inherits:
-
Object
- Object
- Cucumber::Formatter::SimpleDoc
- Includes:
- Console, Io, Term::ANSIColor
- Defined in:
- lib/cucumber/formatter/simpledoc.rb
Overview
Simple documentation formatter
Instance Attribute Summary collapse
-
#runtime ⇒ Object
readonly
Returns the value of attribute runtime.
Instance Method Summary collapse
- #after_background(_background) ⇒ Object
- #after_features(features) ⇒ Object
- #after_table_row(table_row) ⇒ Object
- #background_name(keyword, name, *_args) ⇒ Object
- #before_background(_background) ⇒ Object
- #before_feature(_feature) ⇒ Object
- #before_features(_features) ⇒ Object
- #exception(exception, status, indent = 6) ⇒ Object
- #feature_name(keyword, name) ⇒ Object
-
#initialize(runtime, path_or_io, options) ⇒ SimpleDoc
constructor
A new instance of SimpleDoc.
- #scenario_name(keyword, name, file_colon_line, _source_indent) ⇒ Object
- #step_name(keyword, step_match, *_args) ⇒ Object
Constructor Details
#initialize(runtime, path_or_io, options) ⇒ SimpleDoc
Returns a new instance of SimpleDoc.
15 16 17 18 19 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 15 def initialize(runtime, path_or_io, ) @runtime = runtime @io = ensure_io(path_or_io) @options = end |
Instance Attribute Details
#runtime ⇒ Object (readonly)
Returns the value of attribute runtime.
13 14 15 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 13 def runtime @runtime end |
Instance Method Details
#after_background(_background) ⇒ Object
45 46 47 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 45 def after_background(_background) @in_background = false end |
#after_features(features) ⇒ Object
27 28 29 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 27 def after_features(features) print_summary(features) end |
#after_table_row(table_row) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 75 def after_table_row(table_row) return unless table_row.exception @table_row = table_row @step = " Row: #{table_row.name}" exception(table_row.exception, table_row.status, 6) end |
#background_name(keyword, name, *_args) ⇒ Object
49 50 51 52 53 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 49 def background_name(keyword, name, *_args) @background = " #{keyword}: #{name}" @io.puts @background @io.flush end |
#before_background(_background) ⇒ Object
41 42 43 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 41 def before_background(_background) @in_background = true end |
#before_feature(_feature) ⇒ Object
31 32 33 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 31 def before_feature(_feature) @background_failure = false end |
#before_features(_features) ⇒ Object
21 22 23 24 25 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 21 def before_features(_features) print_profile_information @io.puts 'Testing has started...' @io.flush end |
#exception(exception, status, indent = 6) ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 65 def exception(exception, status, indent = 6) unless @background_failure print_scenario_summary print_exception(exception, status, indent) @io.puts @io.flush end @background_failure = @in_background end |
#feature_name(keyword, name) ⇒ Object
35 36 37 38 39 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 35 def feature_name(keyword, name) @feature = "#{keyword}: #{name.split("\n")[0]}" @io.puts @feature @io.flush end |
#scenario_name(keyword, name, file_colon_line, _source_indent) ⇒ Object
55 56 57 58 59 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 55 def scenario_name(keyword, name, file_colon_line, _source_indent) @scenario = " #{keyword}: #{name}" @io.puts @scenario.to_s.ljust(75) + yellow(" #{file_colon_line}") @io.flush end |
#step_name(keyword, step_match, *_args) ⇒ Object
61 62 63 |
# File 'lib/cucumber/formatter/simpledoc.rb', line 61 def step_name(keyword, step_match, *_args) @step = " #{keyword}#{step_match.format_args}" end |