class Chutney::InvalidStepFlow
service class to lint for invalid step flow
Public Instance Methods
given_after_non_given(feature, scenario, steps)
click to toggle source
# File lib/chutney/linter/invalid_step_flow.rb, line 23 def given_after_non_given(feature, scenario, steps) last_step = steps.first steps.each do |step| if given_word?(step.keyword) && !given_word?(last_step.keyword) add_issue(I18n.t('linters.invalid_step_flow.given_order'), feature, scenario, step) end last_step = step end end
last_step_is_an_action(feature, scenario, steps)
click to toggle source
# File lib/chutney/linter/invalid_step_flow.rb, line 17 def last_step_is_an_action(feature, scenario, steps) return unless when_word?(steps.last.keyword) add_issue(I18n.t('linters.invalid_step_flow.action_last'), feature, scenario, steps.last) end
lint()
click to toggle source
# File lib/chutney/linter/invalid_step_flow.rb, line 6 def lint filled_scenarios do |feature, scenario| steps = scenario.steps.select { |step| !and_word?(step.keyword) && !but_word?(step.keyword) } next if steps.empty? last_step_is_an_action(feature, scenario, steps) given_after_non_given(feature, scenario, steps) verification_before_action(feature, scenario, steps) end end
verification_before_action(feature, scenario, steps)
click to toggle source
# File lib/chutney/linter/invalid_step_flow.rb, line 33 def verification_before_action(feature, scenario, steps) steps.each do |step| break if when_word?(step.keyword) add_issue(I18n.t('linters.invalid_step_flow.missing_action'), feature, scenario) if then_word?(step.keyword) end end