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
-
#failure_count ⇒ Object
Returns the value of attribute failure_count.
-
#pending_count ⇒ Object
Returns the value of attribute pending_count.
-
#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 28 29 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 24 def initialize(output) super(output) @scenarios = [] @failure_count = 0 @pending_count = 0 end |
Instance Attribute Details
#failure_count ⇒ Object
Returns the value of attribute failure_count.
14 15 16 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 14 def failure_count @failure_count end |
#pending_count ⇒ Object
Returns the value of attribute pending_count.
14 15 16 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 14 def pending_count @pending_count end |
#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
31 32 33 34 35 36 37 38 39 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 31 def dump_summary(summary) print_params = { scenarios: scenarios, failed_count: failure_count, pending_count: pending_count, total_time: summary.duration } output_html(print_params) end |
#example_failed(notification) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 56 def example_failed(notification) return unless notification.example.[:type] == :feature @failure_count +=1 scenario = ::TurnipFormatter::Resource::Scenario::Failure.new(notification.example) scenarios << scenario end |
#example_passed(notification) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 41 def example_passed(notification) return unless notification.example.[:type] == :feature scenario = ::TurnipFormatter::Resource::Scenario::Pass.new(notification.example) scenarios << scenario end |
#example_pending(notification) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/rspec/core/formatters/turnip_formatter.rb', line 48 def example_pending(notification) return unless notification.example.[:type] == :feature @pending_count +=1 scenario = ::TurnipFormatter::Resource::Scenario::Pending.new(notification.example) scenarios << scenario end |