Class: RSpec::Core::Formatters::TurnipFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- RSpec::Core::Formatters::TurnipFormatter
- Defined in:
- lib/rspec/core/formatters/turnip_formatter.rb
Instance Attribute Summary collapse
-
#scenarios ⇒ Object
Returns the value of attribute scenarios.
Class Method Summary collapse
Instance Method Summary collapse
- #dump_summary(summary) ⇒ Object
- #example_failed(notification) ⇒ Object
- #example_passed(notification) ⇒ Object
- #example_pending(notification) ⇒ Object
-
#initialize(output) ⇒ TurnipFormatter
constructor
A new instance of TurnipFormatter.
Constructor Details
#initialize(output) ⇒ TurnipFormatter
Returns a new instance of TurnipFormatter.
24 25 26 27 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 24 def initialize(output) super(output) @scenarios = [] end |
Instance Attribute Details
#scenarios ⇒ Object
Returns the value of attribute scenarios.
14 15 16 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 14 def scenarios @scenarios end |
Class Method Details
.formatted_backtrace(example, exception = nil) ⇒ Object
18 19 20 21 22 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 18 def self.formatted_backtrace(example, exception = nil) exception = example.exception if exception.nil? formatter = RSpec.configuration.backtrace_formatter formatter.format_backtrace(exception.backtrace, example.) end |
Instance Method Details
#dump_summary(summary) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 29 def dump_summary(summary) print_params = { scenarios: scenarios, failed_count: summary.failure_count, pending_count: summary.pending_count, total_time: summary.duration } output_html(print_params) end |
#example_failed(notification) ⇒ Object
49 50 51 52 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 49 def example_failed(notification) scenario = ::TurnipFormatter::Resource::Scenario::Failure.new(notification.example) scenarios << scenario end |
#example_passed(notification) ⇒ Object
39 40 41 42 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 39 def example_passed(notification) scenario = ::TurnipFormatter::Resource::Scenario::Pass.new(notification.example) scenarios << scenario end |
#example_pending(notification) ⇒ Object
44 45 46 47 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 44 def example_pending(notification) scenario = ::TurnipFormatter::Resource::Scenario::Pending.new(notification.example) scenarios << scenario end |