Class: RSpec::FlakeClassifier::Rerun::Protocol
- Inherits:
-
Object
- Object
- RSpec::FlakeClassifier::Rerun::Protocol
- Defined in:
- lib/rspec/flake/classifier/rerun/protocol.rb
Instance Attribute Summary collapse
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
-
#same_order_runs ⇒ Object
readonly
Returns the value of attribute same_order_runs.
Instance Method Summary collapse
-
#initialize(runner: IsolatedRunner.new, same_order_runs: 3) ⇒ Protocol
constructor
A new instance of Protocol.
- #investigate(example_id, seed: nil, prior_examples: []) ⇒ Object
Constructor Details
#initialize(runner: IsolatedRunner.new, same_order_runs: 3) ⇒ Protocol
Returns a new instance of Protocol.
12 13 14 15 |
# File 'lib/rspec/flake/classifier/rerun/protocol.rb', line 12 def initialize(runner: IsolatedRunner.new, same_order_runs: 3) @runner = runner @same_order_runs = same_order_runs end |
Instance Attribute Details
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
10 11 12 |
# File 'lib/rspec/flake/classifier/rerun/protocol.rb', line 10 def runner @runner end |
#same_order_runs ⇒ Object (readonly)
Returns the value of attribute same_order_runs.
10 11 12 |
# File 'lib/rspec/flake/classifier/rerun/protocol.rb', line 10 def same_order_runs @same_order_runs end |
Instance Method Details
#investigate(example_id, seed: nil, prior_examples: []) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rspec/flake/classifier/rerun/protocol.rb', line 17 def investigate(example_id, seed: nil, prior_examples: []) sequence = Array(prior_examples) + [example_id] runs = run_same_order(sequence, seed) return true_failure(example_id, runs) if runs.all?(&:failed?) single = runner.run(example_id, seed: seed, extra_args: ["--order", "defined"]) runs << single if !Array(prior_examples).empty? && runs.any?(&:failed?) && single.passed? dependencies = find_dependency(example_id, prior_examples, seed) return flaky(example_id, "od", runs, dependencies, "victim") end flaky(example_id, "nod", runs) end |