Class: TurboTests::JsonExample

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

Instance Method Summary collapse

Constructor Details

#initialize(rspec_example) ⇒ JsonExample

Returns a new instance of JsonExample.



5
6
7
# File 'lib/turbo_tests/json_example.rb', line 5

def initialize(rspec_example)
  @rspec_example = rspec_example
end

Instance Method Details

#to_jsonObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/turbo_tests/json_example.rb', line 9

def to_json
  {
    execution_result: execution_result_to_json(@rspec_example.execution_result),
    location: @rspec_example.location,
    full_description: @rspec_example.full_description,
    metadata: {
      shared_group_inclusion_backtrace:
        @rspec_example.[:shared_group_inclusion_backtrace].map(
          &method(:stack_frame_to_json)
        ),
      extra_failure_lines: @rspec_example.[:extra_failure_lines],
      run_duration_ms: @rspec_example.[:run_duration_ms],
      process_pid: Process.pid,
      js_deprecations: @rspec_example.[:js_deprecations],
      active_record_debug_logs: @rspec_example.[:active_record_debug_logs],
    },
    location_rerun_argument: @rspec_example.location_rerun_argument,
  }
end