Sha256: 16d51b4e0561ec2a97f541bc19a05ff91cf6f381e2ff84db55815830e43205c6
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
# frozen_string_literal: true require 'cucumber/core/test/result' require 'cucumber/core/test/action' module Cucumber module Core module Test class Step attr_reader :source def initialize(source, action = Test::UndefinedAction.new(source.last.location)) raise ArgumentError if source.any?(&:nil?) @source, @action = source, action end def describe_to(visitor, *args) visitor.test_step(self, *args) end def describe_source_to(visitor, *args) source.reverse.each do |node| node.describe_to(visitor, *args) end self end def skip(*args) @action.skip(*args) end def execute(*args) @action.execute(*args) end def with_action(location = nil, &block) self.class.new(source, Test::Action.new(location, &block)) end def text source.last.text end def to_s text end def location source.last.location end def action_location @action.location end def inspect "#<#{self.class}: #{location}>" end end class IsStepVisitor def initialize(test_step) @is_step = false test_step.describe_to(self) end def step? @is_step end def test_step(*) @is_step = true end def method_missing(*) self end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cucumber-core-3.1.0 | lib/cucumber/core/test/step.rb |
cucumber-core-3.0.0 | lib/cucumber/core/test/step.rb |