Class: UpdateFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/formatters/update_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ UpdateFormatter

Returns a new instance of UpdateFormatter.



6
7
8
# File 'lib/formatters/update_formatter.rb', line 6

def initialize(output)
  @output = output
end

Instance Method Details

#example_failed(notification) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/formatters/update_formatter.rb', line 14

def example_failed(notification)
  report({
    :name => notification.example.location,
    :status => "failed",
    :backtrace => notification.exception.backtrace,
    :message => notification.exception.message,
  })
end

#example_passed(notification) ⇒ Object



10
11
12
# File 'lib/formatters/update_formatter.rb', line 10

def example_passed(notification)
  report :name => notification.example.location, :status => "passed"
end

#example_pending(notification) ⇒ Object



23
24
25
# File 'lib/formatters/update_formatter.rb', line 23

def example_pending(notification)
  report :name => notification.example.location, :status => "pending"
end

#report(data) ⇒ Object



27
28
29
# File 'lib/formatters/update_formatter.rb', line 27

def report(data)
  @output << "#{JSON.unparse data}\n"
end