Class: RspecN::Formatters::TableFormatter
- Inherits:
-
Object
- Object
- RspecN::Formatters::TableFormatter
- Includes:
- TimeHelpers
- Defined in:
- lib/rspec_n/formatters/table_formatter.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
Instance Method Summary collapse
-
#initialize(runner:) ⇒ TableFormatter
constructor
A new instance of TableFormatter.
- #observe ⇒ Object
- #show_post_run_info(run) ⇒ Object
- #show_pre_run_info(run) ⇒ Object
Methods included from TimeHelpers
Constructor Details
#initialize(runner:) ⇒ TableFormatter
Returns a new instance of TableFormatter.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rspec_n/formatters/table_formatter.rb', line 8 def initialize(runner:) @runner = runner @columns = { "Run" => 7, "Start Time" => 21, "Finish Time" => 21, "Duration" => 12, "Seed" => 9, "Results" => 50 } @header_columns_string = padded_header_column_labels @table_width = @header_columns_string.size @format = "%m/%d %l:%M:%S %p" end |
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
6 7 8 |
# File 'lib/rspec_n/formatters/table_formatter.rb', line 6 def columns @columns end |
Instance Method Details
#observe ⇒ Object
23 24 25 26 27 |
# File 'lib/rspec_n/formatters/table_formatter.rb', line 23 def observe write_table_header yield write_conclusion end |
#show_post_run_info(run) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/rspec_n/formatters/table_formatter.rb', line 34 def show_post_run_info(run) print pad_field("Finish Time", run.formatted_finish_time(@format)) print duration_field(run) print seed_field(run) puts result_count_field(run) end |
#show_pre_run_info(run) ⇒ Object
29 30 31 32 |
# File 'lib/rspec_n/formatters/table_formatter.rb', line 29 def show_pre_run_info(run) print pad_field("Run", run.iteration) print pad_field("Start Time", run.formatted_start_time(@format)) end |