Class: RSpecTurbo::ProgressReporter

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/rspec_turbo/progress_reporter.rb

Overview

RSpec formatter loaded inside each worker process. Its only job is to write the running example count to RSPEC_TURBO_PROGRESS_FILE after every example, so the parent runner can sum the slots and draw a live progress bar.

Deliberately self-contained (no dependency on the rest of the gem) so it can be required by absolute path inside the spawned rspec process. The slowest files report is produced separately by slow_profile.rb.

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ ProgressReporter

Returns a new instance of ProgressReporter.



21
22
23
24
25
# File 'lib/rspec_turbo/progress_reporter.rb', line 21

def initialize(output)
  super
  @count = 0
  @progress_file = ENV["RSPEC_TURBO_PROGRESS_FILE"]
end

Instance Method Details

#example_failed(_notification) ⇒ Object



31
32
33
# File 'lib/rspec_turbo/progress_reporter.rb', line 31

def example_failed(_notification)
  record
end

#example_passed(_notification) ⇒ Object



27
28
29
# File 'lib/rspec_turbo/progress_reporter.rb', line 27

def example_passed(_notification)
  record
end

#example_pending(_notification) ⇒ Object



35
36
37
# File 'lib/rspec_turbo/progress_reporter.rb', line 35

def example_pending(_notification)
  record
end