Class: KanoahOutputFormatter
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- KanoahOutputFormatter
- Defined in:
- lib/kanoah_output_formatter.rb
Instance Method Summary collapse
- #example_failed(failure) ⇒ Object
- #example_group_finished(_notification) ⇒ Object
- #example_group_started(notification) ⇒ Object
- #example_passed(passed) ⇒ Object
- #example_pending(pending) ⇒ Object
- #example_started(notification) ⇒ Object
-
#initialize(output) ⇒ KanoahOutputFormatter
constructor
A new instance of KanoahOutputFormatter.
Constructor Details
#initialize(output) ⇒ KanoahOutputFormatter
Returns a new instance of KanoahOutputFormatter.
6 7 8 9 |
# File 'lib/kanoah_output_formatter.rb', line 6 def initialize(output) super @group_level = 0 end |
Instance Method Details
#example_failed(failure) ⇒ Object
35 36 37 |
# File 'lib/kanoah_output_formatter.rb', line 35 def example_failed(failure) failure_output(failure.example) end |
#example_group_finished(_notification) ⇒ Object
22 23 24 |
# File 'lib/kanoah_output_formatter.rb', line 22 def example_group_finished(_notification) @group_level -= 1 end |
#example_group_started(notification) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/kanoah_output_formatter.rb', line 15 def example_group_started(notification) output.puts if @group_level.zero? output.puts "#{current_indentation}#{notification.group.description.strip}" @group_level += 1 end |
#example_passed(passed) ⇒ Object
26 27 28 |
# File 'lib/kanoah_output_formatter.rb', line 26 def example_passed(passed) passed_output(passed.example) end |
#example_pending(pending) ⇒ Object
30 31 32 33 |
# File 'lib/kanoah_output_formatter.rb', line 30 def example_pending(pending) pending_output(pending.example, pending.example.execution_result.) end |
#example_started(notification) ⇒ Object
11 12 13 |
# File 'lib/kanoah_output_formatter.rb', line 11 def example_started(notification) notification.example.[:step_index] = 0 end |