File: standard_step_actions.rb

package info (click to toggle)
cucumber 2.4.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,076 kB
  • sloc: ruby: 17,016; javascript: 4,641; makefile: 12; sh: 10; tcl: 3
file content (18 lines) | stat: -rw-r--r-- 440 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Filter that activates steps with obvious pass / fail behaviour
class StandardStepActions < Cucumber::Core::Filter.new
  def test_case(test_case)
    test_steps = test_case.test_steps.map do |step|
      case step.name
      when /fail/
        step.with_action { raise Failure }
      when /pass/
        step.with_action {}
      else
        step
      end
    end

    test_case.with_steps(test_steps).describe_to(receiver)
  end
end