Class: Rspec::Rotten::Formatters::RottenReportFormatter
- Inherits:
-
Object
- Object
- Rspec::Rotten::Formatters::RottenReportFormatter
- Defined in:
- lib/rspec/rotten/formatters/rotten_report_formatter.rb
Instance Method Summary collapse
- #close(notification) ⇒ Object
- #example_failed(notification) ⇒ Object
- #example_passed(notification) ⇒ Object
- #example_pending(notification) ⇒ Object
-
#initialize(output) ⇒ RottenReportFormatter
constructor
A new instance of RottenReportFormatter.
Constructor Details
#initialize(output) ⇒ RottenReportFormatter
Returns a new instance of RottenReportFormatter.
11 12 13 14 |
# File 'lib/rspec/rotten/formatters/rotten_report_formatter.rb', line 11 def initialize(output) @output = output @store = ExampleStore.new end |
Instance Method Details
#close(notification) ⇒ Object
46 47 48 49 |
# File 'lib/rspec/rotten/formatters/rotten_report_formatter.rb', line 46 def close(notification) @store.save @output << @store.notify_rotten if @store.rotten.any? end |
#example_failed(notification) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/rspec/rotten/formatters/rotten_report_formatter.rb', line 26 def example_failed(notification) record = @store.find(notification.example) if record && record['state'] != 'failed' @store.delete record @store.records << example_data(notification.example, :failed) elsif record.nil? @store.records << example_data(notification.example, :failed) end end |
#example_passed(notification) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/rspec/rotten/formatters/rotten_report_formatter.rb', line 16 def example_passed(notification) record = @store.find(notification.example) if record && record['state'] != 'passed' @store.delete record @store.records << example_data(notification.example, :passed) elsif record.nil? @store.records << example_data(notification.example, :passed) end end |
#example_pending(notification) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/rspec/rotten/formatters/rotten_report_formatter.rb', line 36 def example_pending(notification) record = @store.find(notification.example) if record && record['state'] != 'pending' @store.delete record @store.records << example_data(notification.example, :pending) elsif record.nil? @store.records << example_data(notification.example, :pending) end end |