Class: Coatepec::Spec::Runner
- Inherits:
-
Object
- Object
- Coatepec::Spec::Runner
- Defined in:
- lib/coatepec/spec/runner.rb
Overview
Validates a rails_spec_run request's paths, builds the RSpec CLI
args, and delegates to the platform-appropriate process strategy
(fork on Linux, spawn on macOS, or a guarded fork on macOS when the
project opts in via .coatepec.yml).
Constant Summary collapse
- DEFAULT_TIMEOUT =
120
Instance Method Summary collapse
-
#initialize(project_root, rails_runtime: nil) ⇒ Runner
constructor
A new instance of Runner.
- #run(paths:, example: nil, seed: nil, fail_fast: false, timeout_seconds: DEFAULT_TIMEOUT) ⇒ Object
Constructor Details
#initialize(project_root, rails_runtime: nil) ⇒ Runner
Returns a new instance of Runner.
12 13 14 15 16 17 |
# File 'lib/coatepec/spec/runner.rb', line 12 def initialize(project_root, rails_runtime: nil) @project_root = project_root @project = Project.new(project_root) @path_policy = PathPolicy.new(@project) @rails_runtime = rails_runtime end |
Instance Method Details
#run(paths:, example: nil, seed: nil, fail_fast: false, timeout_seconds: DEFAULT_TIMEOUT) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/coatepec/spec/runner.rb', line 19 def run(paths:, example: nil, seed: nil, fail_fast: false, timeout_seconds: DEFAULT_TIMEOUT) require_rspec! selectors = @path_policy.validate!(paths) args = build_args(selectors, example, seed, fail_fast) strategy_class.new(@project_root, project: @project, rails_runtime: @rails_runtime).run(args, timeout_seconds) end |