class Rspec::Rotten::Formatters::RottenReportFormatter
Public Class Methods
new(output)
click to toggle source
# File lib/rspec/rotten/formatters/rotten_report_formatter.rb, line 11 def initialize(output) @output = output @store = ExampleStore.new end
Public Instance Methods
close(notification)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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
Private Instance Methods
example_data(example, status)
click to toggle source
# File lib/rspec/rotten/formatters/rotten_report_formatter.rb, line 53 def example_data(example, status) { id: example.id, state: status, date: Time.now, location: example.location, description: example.description } end