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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, action = Test::UndefinedAction.new(source.last.location)) ⇒ Step

Returns a new instance of Step.

Raises:

  • (ArgumentError)


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

def initialize(source, action = Test::UndefinedAction.new(source.last.location))
  raise ArgumentError if source.any?(&:nil?)
  @source, @action = source, action
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



9
10
11
# File 'lib/cucumber/core/test/step.rb', line 9

def source
  @source
end

Instance Method Details

#action_locationObject



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

def action_location
  @action.location
end

#describe_source_to(visitor, *args) ⇒ Object



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

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

#describe_to(visitor, *args) ⇒ Object



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

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

#execute(*args) ⇒ Object



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

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

#inspectObject



59
60
61
# File 'lib/cucumber/core/test/step.rb', line 59

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

#locationObject



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

def location
  source.last.location
end

#original_locationObject



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

def original_location
  source.last.original_location
end

#skip(*args) ⇒ Object



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

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

#textObject



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

def text
  source.last.text
end

#to_sObject



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

def to_s
  text
end

#with_action(location = nil, &block) ⇒ Object



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

def with_action(location = nil, &block)
  self.class.new(source, Test::Action.new(location, &block))
end