Class: Cucumber::Core::Test::Step
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Step
- Defined in:
- lib/cucumber/core/test/step.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#multiline_arg ⇒ Object
readonly
Returns the value of attribute multiline_arg.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #action_location ⇒ Object
- #backtrace_line ⇒ Object
- #describe_to(visitor) ⇒ Object
- #execute ⇒ Object
- #hook? ⇒ Boolean
-
#initialize(id, text, location, multiline_arg = Test::EmptyMultilineArgument.new, action = Test::Action::Undefined.new(location)) ⇒ Step
constructor
A new instance of Step.
- #inspect ⇒ Object
- #matching_locations ⇒ Object
- #skip ⇒ Object
- #to_s ⇒ Object
- #with_action(action_location = nil) ⇒ Object
- #with_unskippable_action(action_location = nil) ⇒ Object
Constructor Details
#initialize(id, text, location, multiline_arg = Test::EmptyMultilineArgument.new, action = Test::Action::Undefined.new(location)) ⇒ Step
Returns a new instance of Step.
12 13 14 15 16 17 18 19 20 |
# File 'lib/cucumber/core/test/step.rb', line 12 def initialize(id, text, location, multiline_arg = Test::EmptyMultilineArgument.new, action = Test::Action::Undefined.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
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/cucumber/core/test/step.rb', line 10 def id @id end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
10 11 12 |
# File 'lib/cucumber/core/test/step.rb', line 10 def location @location end |
#multiline_arg ⇒ Object (readonly)
Returns the value of attribute multiline_arg.
10 11 12 |
# File 'lib/cucumber/core/test/step.rb', line 10 def multiline_arg @multiline_arg end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
10 11 12 |
# File 'lib/cucumber/core/test/step.rb', line 10 def text @text end |
Instance Method Details
#action_location ⇒ Object
22 23 24 |
# File 'lib/cucumber/core/test/step.rb', line 22 def action_location @action.location end |
#backtrace_line ⇒ Object
26 27 28 |
# File 'lib/cucumber/core/test/step.rb', line 26 def backtrace_line "#{location}:in `#{text}'" end |
#describe_to(visitor) ⇒ Object
30 31 32 |
# File 'lib/cucumber/core/test/step.rb', line 30 def describe_to(visitor, *) visitor.test_step(self, *) end |
#execute ⇒ Object
34 35 36 |
# File 'lib/cucumber/core/test/step.rb', line 34 def execute(*) @action.execute(*) end |
#hook? ⇒ Boolean
38 39 40 |
# File 'lib/cucumber/core/test/step.rb', line 38 def hook? false end |
#inspect ⇒ Object
42 43 44 |
# File 'lib/cucumber/core/test/step.rb', line 42 def inspect "#<#{self.class}: #{location}>" end |
#matching_locations ⇒ Object
46 47 48 |
# File 'lib/cucumber/core/test/step.rb', line 46 def matching_locations [location.merge(multiline_arg)] end |
#skip ⇒ Object
50 51 52 |
# File 'lib/cucumber/core/test/step.rb', line 50 def skip(*) @action.skip(*) end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/cucumber/core/test/step.rb', line 54 def to_s text end |
#with_action(action_location = nil) ⇒ Object
58 59 60 |
# File 'lib/cucumber/core/test/step.rb', line 58 def with_action(action_location = nil, &) self.class.new(id, text, location, multiline_arg, Test::Action::Defined.new(action_location, &)) end |
#with_unskippable_action(action_location = nil) ⇒ Object
62 63 64 |
# File 'lib/cucumber/core/test/step.rb', line 62 def with_unskippable_action(action_location = nil, &) self.class.new(id, text, location, multiline_arg, Test::Action::Unskippable.new(action_location, &)) end |