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

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

Direct Known Subclasses

HookStep

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, location, multiline_arg = Test::EmptyMultilineArgument.new, action = Test::UndefinedAction.new(location)) ⇒ Step

Returns a new instance of Step.

Raises:

  • (ArgumentError)


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

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

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



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

def location
  @location
end

#multiline_argObject (readonly)

Returns the value of attribute multiline_arg.



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

def multiline_arg
  @multiline_arg
end

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

Instance Method Details

#action_locationObject



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

def action_location
  @action.location
end

#backtrace_lineObject



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

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

#describe_to(visitor, *args) ⇒ Object



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

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

#execute(*args) ⇒ Object



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

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

#hook?Boolean

Returns:

  • (Boolean)


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

def hook?
  false
end

#inspectObject



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

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

#skip(*args) ⇒ Object



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

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

#to_sObject



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

def to_s
  text
end

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



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

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