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.



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

def initialize(output)
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



36
37
38
# File 'lib/turbo_tests/json_rows_formatter.rb', line 36

def output
  @output
end

Instance Method Details

#close(_notification) ⇒ Object



91
92
93
94
95
# File 'lib/turbo_tests/json_rows_formatter.rb', line 91

def close(_notification)
  output_row(
    type: :close,
  )
end

#example_failed(notification) ⇒ Object



77
78
79
80
81
82
# File 'lib/turbo_tests/json_rows_formatter.rb', line 77

def example_failed(notification)
  output_row(
    type: :example_failed,
    example: example_to_json(notification.example),
  )
end

#example_group_finished(notification) ⇒ Object



56
57
58
59
60
61
# File 'lib/turbo_tests/json_rows_formatter.rb', line 56

def example_group_finished(notification)
  output_row(
    type: :group_finished,
    group: group_to_json(notification),
  )
end

#example_group_started(notification) ⇒ Object



49
50
51
52
53
54
# File 'lib/turbo_tests/json_rows_formatter.rb', line 49

def example_group_started(notification)
  output_row(
    type: :group_started,
    group: group_to_json(notification),
  )
end

#example_passed(notification) ⇒ Object



63
64
65
66
67
68
# File 'lib/turbo_tests/json_rows_formatter.rb', line 63

def example_passed(notification)
  output_row(
    type: :example_passed,
    example: example_to_json(notification.example),
  )
end

#example_pending(notification) ⇒ Object



70
71
72
73
74
75
# File 'lib/turbo_tests/json_rows_formatter.rb', line 70

def example_pending(notification)
  output_row(
    type: :example_pending,
    example: example_to_json(notification.example),
  )
end

#message(notification) ⇒ Object



97
98
99
100
101
102
# File 'lib/turbo_tests/json_rows_formatter.rb', line 97

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

#seed(notification) ⇒ Object



84
85
86
87
88
89
# File 'lib/turbo_tests/json_rows_formatter.rb', line 84

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

#start(notification) ⇒ Object



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

def start(notification)
  output_row(
    type: :load_summary,
    summary: load_summary_to_json(notification),
  )
end