Class: RSpec::FlakeClassifier::Rerun::Investigation
- Inherits:
-
Object
- Object
- RSpec::FlakeClassifier::Rerun::Investigation
- Defined in:
- lib/rspec/flake/classifier/rerun/result.rb,
sig/rspec/flake/classifier.rbs
Instance Attribute Summary collapse
-
#dependency_examples ⇒ Array[String]
readonly
Returns the value of attribute dependency_examples.
-
#dependency_role ⇒ String?
readonly
Returns the value of attribute dependency_role.
-
#example_id ⇒ String
readonly
Returns the value of attribute example_id.
-
#order_type ⇒ String?
readonly
Returns the value of attribute order_type.
-
#runs ⇒ Array[untyped]
readonly
Returns the value of attribute runs.
-
#status ⇒ String
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #flaky? ⇒ Boolean
-
#initialize(example_id:, status:, order_type:, runs:, dependency_examples: [], dependency_role: nil) ⇒ Investigation
constructor
A new instance of Investigation.
- #labels ⇒ Array[String]
- #to_h ⇒ Hash[String, untyped]
- #true_failure? ⇒ Boolean
Constructor Details
#initialize(example_id:, status:, order_type:, runs:, dependency_examples: [], dependency_role: nil) ⇒ Investigation
Returns a new instance of Investigation.
41 42 43 44 45 46 47 48 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 41 def initialize(example_id:, status:, order_type:, runs:, dependency_examples: [], dependency_role: nil) @example_id = example_id @status = status.to_s @order_type = order_type&.to_s @runs = runs @dependency_examples = dependency_examples @dependency_role = dependency_role&.to_s end |
Instance Attribute Details
#dependency_examples ⇒ Array[String] (readonly)
Returns the value of attribute dependency_examples.
38 39 40 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 38 def dependency_examples @dependency_examples end |
#dependency_role ⇒ String? (readonly)
Returns the value of attribute dependency_role.
38 39 40 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 38 def dependency_role @dependency_role end |
#example_id ⇒ String (readonly)
Returns the value of attribute example_id.
38 39 40 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 38 def example_id @example_id end |
#order_type ⇒ String? (readonly)
Returns the value of attribute order_type.
38 39 40 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 38 def order_type @order_type end |
#runs ⇒ Array[untyped] (readonly)
Returns the value of attribute runs.
38 39 40 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 38 def runs @runs end |
#status ⇒ String (readonly)
Returns the value of attribute status.
38 39 40 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 38 def status @status end |
Instance Method Details
#flaky? ⇒ Boolean
50 51 52 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 50 def flaky? status == "flaky" end |
#labels ⇒ Array[String]
58 59 60 61 62 63 64 65 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 58 def labels labels = [] labels << "flaky" if flaky? labels << "order-dependent" if order_type == "od" labels << "non-order-dependent" if order_type == "nod" labels << dependency_role if dependency_role labels end |
#to_h ⇒ Hash[String, untyped]
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 67 def to_h { "example_id" => example_id, "status" => status, "order_type" => order_type, "dependency_role" => dependency_role, "labels" => labels, "dependency_examples" => dependency_examples, "polluter_candidates" => dependency_role == "victim" ? dependency_examples : [], "runs" => runs.map(&:to_h) } end |
#true_failure? ⇒ Boolean
54 55 56 |
# File 'lib/rspec/flake/classifier/rerun/result.rb', line 54 def true_failure? status == "true_failure" end |