Class: CukeLinter::TestShouldUseBackgroundLinter
- Defined in:
- lib/cuke_linter/linters/test_should_use_background_linter.rb
Overview
A linter that detects scenarios and outlines within a feature that all share common beginning steps
Instance Attribute Summary
Attributes inherited from Linter
Instance Method Summary collapse
-
#message ⇒ Object
The message used to describe the problem that has been found.
-
#rule(model) ⇒ Object
The rule used to determine if a model has a problem.
Methods inherited from Linter
Constructor Details
This class inherits a constructor from CukeLinter::Linter
Instance Method Details
#message ⇒ Object
The message used to describe the problem that has been found
24 25 26 |
# File 'lib/cuke_linter/linters/test_should_use_background_linter.rb', line 24 def 'Test shares steps with all other tests in feature. Use a background.' end |
#rule(model) ⇒ Object
The rule used to determine if a model has a problem
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cuke_linter/linters/test_should_use_background_linter.rb', line 9 def rule(model) return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline) model_steps = model.steps || [] parent_feature_model = model.get_ancestor(:feature) return false unless parent_feature_model.tests.count > 1 matching_steps = all_first_steps_match?(parent_feature_model, model_steps) none_parameterized = no_parameterized_steps?(parent_feature_model) matching_steps && none_parameterized end |