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

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb

Direct Known Subclasses

HookStep

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, 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
20
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 13

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



11
12
13
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 11

def id
  @id
end

#locationObject (readonly)

Returns the value of attribute location.



11
12
13
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/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/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/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/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 11

def text
  @text
end

Instance Method Details

#action_locationObject



50
51
52
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 50

def action_location
  @action.location
end

#backtrace_lineObject



42
43
44
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 42

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

#describe_to(visitor, *args) ⇒ Object



22
23
24
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 22

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

#execute(*args) ⇒ Object



34
35
36
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 34

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

#hook?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 26

def hook?
  false
end

#inspectObject



54
55
56
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 54

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

#skip(*args) ⇒ Object



30
31
32
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 30

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

#to_sObject



46
47
48
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 46

def to_s
  text
end

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



38
39
40
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/step.rb', line 38

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