Sha256: 4eef02931d0272d10dbb0bdda94c38cac58241c1f4198a294eeca0829cdb3831
Contents?: true
Size: 669 Bytes
Versions: 2
Compression:
Stored size: 669 Bytes
Contents
require 'gherkin_lint/linter' module GherkinLint # service class to lint for avoid scripting class AvoidScripting < Linter def lint filled_scenarios do |file, feature, scenario| steps = filter_when_steps scenario['steps'] next if steps.length <= 1 references = [reference(file, feature, scenario)] add_error(references, 'Multiple Actions') end end def filter_when_steps(steps) steps = steps.drop_while { |step| step['keyword'] != 'When ' } steps = steps.reverse.drop_while { |step| step['keyword'] != 'Then ' }.reverse steps.select { |step| step['keyword'] != 'Then ' } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gherkin_lint-0.3.1 | lib/gherkin_lint/linter/avoid_scripting.rb |
gherkin_lint-0.3.0 | lib/gherkin_lint/linter/avoid_scripting.rb |