Class: Buildkite::TestCollector::RSpecPlugin::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/buildkite/test_collector/rspec_plugin/reporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Reporter

Returns a new instance of Reporter.



9
10
11
12
# File 'lib/buildkite/test_collector/rspec_plugin/reporter.rb', line 9

def initialize(output)
  Buildkite::TestCollector.session = Buildkite::TestCollector::Session.new
  @output = output
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



7
8
9
# File 'lib/buildkite/test_collector/rspec_plugin/reporter.rb', line 7

def output
  @output
end

Instance Method Details

#dump_summary(_notification) ⇒ Object



27
28
29
30
# File 'lib/buildkite/test_collector/rspec_plugin/reporter.rb', line 27

def dump_summary(_notification)
  Buildkite::TestCollector.session.send_remaining_data
  Buildkite::TestCollector.session.close
end

#handle_example(notification) ⇒ Object Also known as: example_passed, example_failed, example_pending



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/buildkite/test_collector/rspec_plugin/reporter.rb', line 14

def handle_example(notification)
  example = notification.example
  trace = Buildkite::TestCollector.uploader.traces[example.id]

  if trace
    trace.example = example
    if example.execution_result.status == :failed
      trace.failure_reason, trace.failure_expanded = failure_info(notification)
    end
    Buildkite::TestCollector.session.add_example_to_send_queue(example.id)
  end
end