Module: Polyrun::RSpec::ShardedFormatterCompat

Defined in:
lib/polyrun/rspec/sharded_formatter_compat.rb

Overview

Formatter tweaks for progress bars (e.g. Fuubar) under POLYRUN_SHARD_* workers.

Class Method Summary collapse

Class Method Details

.install!(rspec_config: fetch_rspec_configuration!) ) ⇒ Object



7
8
9
10
11
12
# File 'lib/polyrun/rspec/sharded_formatter_compat.rb', line 7

def install!(rspec_config: fetch_rspec_configuration!)
  return unless sharded_worker?

  rspec_config.silence_filter_announcements = true
  noop_fuubar_seed! if defined?(Fuubar)
end

.noop_fuubar_seed!Object



18
19
20
21
22
23
24
25
# File 'lib/polyrun/rspec/sharded_formatter_compat.rb', line 18

def noop_fuubar_seed!
  return unless defined?(Fuubar)

  Fuubar.class_eval do
    def seed(_notification)
    end
  end
end

.sharded_worker?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/polyrun/rspec/sharded_formatter_compat.rb', line 14

def sharded_worker?
  !ENV["POLYRUN_SHARD_TOTAL"].to_s.strip.empty?
end