Class: Cucumber::Core::Test::Step

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/core/test/step.rb

Instance Method Summary collapse

Constructor Details

#initialize(source, mapping = Test::UndefinedMapping.new) ⇒ Step

Returns a new instance of Step.

Raises:

  • (ArgumentError)


11
12
13
14
15
# File 'lib/cucumber/core/test/step.rb', line 11

def initialize(source, mapping = Test::UndefinedMapping.new)
  raise ArgumentError if source.any?(&:nil?)
  @mapping = mapping
  super(source)
end

Instance Method Details

#describe_source_to(visitor, *args) ⇒ Object



21
22
23
24
25
# File 'lib/cucumber/core/test/step.rb', line 21

def describe_source_to(visitor, *args)
  source.each do |node|
    node.describe_to(visitor, *args)
  end
end

#describe_to(visitor, *args) ⇒ Object



17
18
19
# File 'lib/cucumber/core/test/step.rb', line 17

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

#executeObject



39
40
41
# File 'lib/cucumber/core/test/step.rb', line 39

def execute
  @mapping.execute
end

#inspectObject



56
57
58
# File 'lib/cucumber/core/test/step.rb', line 56

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

#locationObject



47
48
49
# File 'lib/cucumber/core/test/step.rb', line 47

def location
  step.location
end

#map(&block) ⇒ Object



43
44
45
# File 'lib/cucumber/core/test/step.rb', line 43

def map(&block)
  self.class.new(source, Test::Mapping.new(&block))
end

#match_locations?(queried_locations) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
54
# File 'lib/cucumber/core/test/step.rb', line 51

def match_locations?(queried_locations)
  return true if queried_locations.include? location
  source.any? { |s| s.match_locations?(queried_locations) }
end

#multiline_argObject



31
32
33
# File 'lib/cucumber/core/test/step.rb', line 31

def multiline_arg
  step.multiline_arg
end

#nameObject



27
28
29
# File 'lib/cucumber/core/test/step.rb', line 27

def name
  step.name
end

#skipObject



35
36
37
# File 'lib/cucumber/core/test/step.rb', line 35

def skip
  @mapping.skip
end