Class: Evilution::Reporter::Suggestion Private
- Inherits:
-
Object
- Object
- Evilution::Reporter::Suggestion
- Defined in:
- lib/evilution/reporter/suggestion.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: DiffHelpers, Templates Classes: DiffLines, Registry
Constant Summary collapse
- DEFAULT_SUGGESTION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"Add a more specific test that detects this mutation"
Instance Method Summary collapse
-
#call(summary) ⇒ Array<Hash>
private
Generate suggestions for survived mutations.
-
#initialize(suggest_tests: false, integration: :rspec, registry: Registry.default) ⇒ Suggestion
constructor
private
A new instance of Suggestion.
-
#suggestion_for(mutation) ⇒ String
private
Generate a suggestion for a single mutation.
Constructor Details
#initialize(suggest_tests: false, integration: :rspec, registry: Registry.default) ⇒ Suggestion
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Suggestion.
8 9 10 11 12 |
# File 'lib/evilution/reporter/suggestion.rb', line 8 def initialize(suggest_tests: false, integration: :rspec, registry: Registry.default) @suggest_tests = suggest_tests @integration = integration @registry = registry end |
Instance Method Details
#call(summary) ⇒ Array<Hash>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Generate suggestions for survived mutations.
18 19 20 21 22 23 24 25 |
# File 'lib/evilution/reporter/suggestion.rb', line 18 def call(summary) summary.survived_results.map do |result| { mutation: result.mutation, suggestion: suggestion_for(result.mutation) } end end |
#suggestion_for(mutation) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Generate a suggestion for a single mutation.
31 32 33 34 35 36 37 38 39 |
# File 'lib/evilution/reporter/suggestion.rb', line 31 def suggestion_for(mutation) op = mutation.operator_name if @suggest_tests concrete = @registry.concrete(op, integration: @integration) return concrete.call(mutation) if concrete end @registry.generic(op) || DEFAULT_SUGGESTION end |