Sha256: d9584048ee76169aa27a208acd1674f073f4317fbe9d484cb02fed958dc7bed0

Contents?: true

Size: 1.56 KB

Versions: 16

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

require 'cucumber/core/test/result'
require 'cucumber/core/test/action'
require 'cucumber/core/test/empty_multiline_argument'

module Cucumber
  module Core
    module Test
      class Step
        attr_reader :id, :text, :location, :multiline_arg

        def initialize(id, text, location, multiline_arg = Test::EmptyMultilineArgument.new, action = Test::UndefinedAction.new(location))
          raise ArgumentError if text.nil? || text.empty?
          @id = id
          @text = text
          @location = location
          @multiline_arg = multiline_arg
          @action = action
        end

        def describe_to(visitor, *args)
          visitor.test_step(self, *args)
        end

        def hook?
          false
        end

        def skip(*args)
          @action.skip(*args)
        end

        def execute(*args)
          @action.execute(*args)
        end

        def with_action(action_location = nil, &block)
          self.class.new(id, text, location, multiline_arg, Test::Action.new(action_location, &block))
        end

        def backtrace_line
          "#{location}:in `#{text}'"
        end

        def to_s
          text
        end

        def action_location
          @action.location
        end

        def inspect
          "#<#{self.class}: #{location}>"
        end
      end

      class HookStep < Step
        def initialize(id, text, location, action)
          super(id, text, location, Test::EmptyMultilineArgument.new, action)
        end

        def hook?
          true
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb
cucumber-core-11.0.0 lib/cucumber/core/test/step.rb
cucumber-core-10.1.1 lib/cucumber/core/test/step.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-core-10.1.0/lib/cucumber/core/test/step.rb
cucumber-core-10.1.0 lib/cucumber/core/test/step.rb
cucumber-core-10.0.1 lib/cucumber/core/test/step.rb
cucumber-core-10.0.0 lib/cucumber/core/test/step.rb
cucumber-core-9.0.1 lib/cucumber/core/test/step.rb
cucumber-core-9.0.0 lib/cucumber/core/test/step.rb
cucumber-core-8.0.1 lib/cucumber/core/test/step.rb
cucumber-core-7.1.0 lib/cucumber/core/test/step.rb
cucumber-core-7.0.0 lib/cucumber/core/test/step.rb
cucumber-core-6.0.0 lib/cucumber/core/test/step.rb