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)


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

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.



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

def source
  @source
end

Instance Method Details

#action_locationObject



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

def action_location
  @action.location
end

#describe_source_to(visitor, *args) ⇒ Object



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

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

#describe_to(visitor, *args) ⇒ Object



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

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

#execute(*args) ⇒ Object



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

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

#inspectObject



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

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

#locationObject



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

def location
  source.last.location
end

#nameObject



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

def name
  source.last.name
end

#skip(*args) ⇒ Object



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

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

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



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

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