Sha256: 36eb438348be13b2e59362dceb488dbe911e8076110dd07fedcdd8221cf0f6c2

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Cucumber
  module Core
    module Test
      module Filters
        # This filter is used for testing Cucumber itself. It adds step definitions
        # that will activate steps to have passed / failed / pending results
        # if they use conventional names.
        #
        # It was extracted from our test code, and does not have any tests of its own.
        class ActivateStepsForSelfTest < Core::Filter.new
          Failure = Class.new(StandardError)

          def test_case(test_case)
            test_steps = test_case.test_steps.map do |step|
              case step.text
              when /fail/
                step.with_action { raise Failure }
              when /pending/
                step.with_action { raise Test::Result::Pending }
              when /pass/
                step.with_action { :no_op }
              else
                step
              end
            end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cucumber-core-13.0.0 lib/cucumber/core/test/filters/activate_steps_for_self_test.rb