Class: TurboTests::JsonRowsFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo_tests/json_rows_formatter.rb

Overview

An RSpec formatter used for each subprocess during parallel test execution

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ JsonRowsFormatter

Returns a new instance of JsonRowsFormatter.



18
19
20
# File 'lib/turbo_tests/json_rows_formatter.rb', line 18

def initialize(output)
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



16
17
18
# File 'lib/turbo_tests/json_rows_formatter.rb', line 16

def output
  @output
end

Instance Method Details

#close(notification) ⇒ Object



38
39
40
# File 'lib/turbo_tests/json_rows_formatter.rb', line 38

def close(notification)
  output_row(type: :close)
end

#example_failed(notification) ⇒ Object



30
31
32
# File 'lib/turbo_tests/json_rows_formatter.rb', line 30

def example_failed(notification)
  output_row(type: :example_failed, example: JsonExample.new(notification.example).to_json)
end

#example_passed(notification) ⇒ Object



22
23
24
# File 'lib/turbo_tests/json_rows_formatter.rb', line 22

def example_passed(notification)
  output_row(type: :example_passed, example: JsonExample.new(notification.example).to_json)
end

#example_pending(notification) ⇒ Object



26
27
28
# File 'lib/turbo_tests/json_rows_formatter.rb', line 26

def example_pending(notification)
  output_row(type: :example_pending, example: JsonExample.new(notification.example).to_json)
end

#message(notification) ⇒ Object



42
43
44
# File 'lib/turbo_tests/json_rows_formatter.rb', line 42

def message(notification)
  output_row(type: :message, message: notification.message)
end

#seed(notification) ⇒ Object



34
35
36
# File 'lib/turbo_tests/json_rows_formatter.rb', line 34

def seed(notification)
  output_row(type: :seed, seed: notification.seed)
end