Class: RSpec::Core::Formatters::DocumentationFormatter
- Inherits:
-
BaseTextFormatter
- Object
- BaseTextFormatter
- RSpec::Core::Formatters::DocumentationFormatter
- Defined in:
- lib/bdd/rspec/documentation_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) ⇒ DocumentationFormatter
constructor
A new instance of DocumentationFormatter.
Constructor Details
#initialize(output) ⇒ DocumentationFormatter
Returns a new instance of DocumentationFormatter.
12 13 14 15 |
# File 'lib/bdd/rspec/documentation_formatter.rb', line 12 def initialize(output) super @group_level = 0 end |
Instance Method Details
#example_failed(failure) ⇒ Object
44 45 46 47 48 |
# File 'lib/bdd/rspec/documentation_formatter.rb', line 44 def example_failed(failure) output.puts failure_output(failure.example, failure.example.execution_result.exception) output.puts read_steps(failure.example, :red) end |
#example_group_finished(_notification) ⇒ Object
29 30 31 |
# File 'lib/bdd/rspec/documentation_formatter.rb', line 29 def example_group_finished(_notification) @group_level -= 1 end |
#example_group_started(notification) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/bdd/rspec/documentation_formatter.rb', line 22 def example_group_started(notification) output.puts if @group_level == 0 output.puts "#{current_indentation}#{notification.group.description.strip}" @group_level += 1 end |
#example_passed(passed) ⇒ Object
33 34 35 36 |
# File 'lib/bdd/rspec/documentation_formatter.rb', line 33 def example_passed(passed) output.puts passed_output(passed.example) output.puts read_steps(passed.example) end |
#example_pending(pending) ⇒ Object
38 39 40 41 42 |
# File 'lib/bdd/rspec/documentation_formatter.rb', line 38 def example_pending(pending) output.puts pending_output(pending.example, pending.example.execution_result.) output.puts read_steps(pending.example, :yellow) end |
#example_started(notification) ⇒ Object
18 19 20 |
# File 'lib/bdd/rspec/documentation_formatter.rb', line 18 def example_started(notification) notification.example.[:step_messages] = [] end |