Class: GherkinLint::BackgroundRequiresMultipleScenarios
- Defined in:
- lib/gherkin_lint/linter/background_requires_multiple_scenarios.rb
Overview
service class for check that there are multiple scenarios once a background is used
Instance Attribute Summary
Attributes inherited from Linter
Instance Method Summary collapse
Methods inherited from Linter
#add_error, #add_warning, #backgrounds, #elements, #features, #files, #filled_scenarios, #filter_tag, #gather_tags, #initialize, #line, #lint_files, #name, #reference, #render_step, #scenarios, #steps, #suppress, #suppress_tags, #tag?
Constructor Details
This class inherits a constructor from GherkinLint::Linter
Instance Method Details
#lint ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/gherkin_lint/linter/background_requires_multiple_scenarios.rb', line 6 def lint backgrounds do |file, feature, background| scenarios = feature['elements'].select { |element| element['keyword'] != 'Background' } next if scenarios.length >= 2 references = [reference(file, feature, background)] add_error(references, "There are just #{scenarios.length} scenarios") end end |