class UpdateFormatter
Public Class Methods
new(output)
click to toggle source
# File lib/formatters/update_formatter.rb, line 8 def initialize(output) @output = output end
Public Instance Methods
example_failed(notification)
click to toggle source
# File lib/formatters/update_formatter.rb, line 16 def example_failed(notification) report notification.example, "failed", { :backtrace => notification.exception.backtrace, :message => notification.exception.message, } end
example_passed(notification)
click to toggle source
# File lib/formatters/update_formatter.rb, line 12 def example_passed(notification) report notification.example, "passed" end
example_pending(notification)
click to toggle source
# File lib/formatters/update_formatter.rb, line 23 def example_pending(notification) report notification.example, "pending" end
Private Instance Methods
filtered_files_touched(example)
click to toggle source
# File lib/formatters/update_formatter.rb, line 38 def filtered_files_touched(example) raw_files = example.metadata[:files_touched].keys raw_files.select { |file| file.start_with? Dir.pwd } end
report(example, status, options = {})
click to toggle source
# File lib/formatters/update_formatter.rb, line 29 def report(example, status, options = {}) data = { :name => example.location, :status => status, :files_touched => filtered_files_touched(example), } @output << "\n#{JSON.unparse data.merge(options)}\n" end