Module: Polyrun::RSpec
- Defined in:
- lib/polyrun/rspec.rb
Overview
Optional RSpec wiring (require polyrun/rspec explicitly).
Class Method Summary collapse
-
.install_example_timing!(output_path: nil) ⇒ Object
Experimental: add Timing::RSpecExampleFormatter and write per-example JSON (see timing_granularity: example).
-
.install_parallel_provisioning!(rspec_config) ⇒ Object
Registers before(:suite) to run Data::ParallelProvisioning.run_suite_hooks!.
Class Method Details
.install_example_timing!(output_path: nil) ⇒ Object
Experimental: add Timing::RSpecExampleFormatter and write per-example JSON (see timing_granularity: example). With output_path:, that path is used directly (no ENV mutation). Without it, the formatter reads ENV or defaults to polyrun_timing_examples.json.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/polyrun/rspec.rb', line 18 def install_example_timing!(output_path: nil) require_relative "timing/rspec_example_formatter" fmt = if output_path op = output_path Class.new(Polyrun::Timing::RSpecExampleFormatter) do define_method(:timing_output_path) { op } end else Polyrun::Timing::RSpecExampleFormatter end ::RSpec.configure do |config| config.add_formatter fmt end end |
.install_parallel_provisioning!(rspec_config) ⇒ Object
Registers before(:suite) to run Data::ParallelProvisioning.run_suite_hooks!.
9 10 11 12 13 |
# File 'lib/polyrun/rspec.rb', line 9 def install_parallel_provisioning!(rspec_config) rspec_config.before(:suite) do Polyrun::Data::ParallelProvisioning.run_suite_hooks! end end |