Class: Cucumber::Core::Test::Action::Defined
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Action::Defined
- Defined in:
- lib/cucumber/core/test/action/defined.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Instance Method Summary collapse
- #execute(*args) ⇒ Object
-
#initialize(location = nil, &block) ⇒ Defined
constructor
A new instance of Defined.
- #inspect ⇒ Object
- #skip ⇒ Object
Constructor Details
#initialize(location = nil, &block) ⇒ Defined
Returns a new instance of Defined.
14 15 16 17 18 19 20 |
# File 'lib/cucumber/core/test/action/defined.rb', line 14 def initialize(location = nil, &block) raise ArgumentError, 'Passing a block to execute the action is mandatory.' unless block @location = location || Test::Location.new(*block.source_location) @block = block @timer = Timer.new end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
12 13 14 |
# File 'lib/cucumber/core/test/action/defined.rb', line 12 def location @location end |
Instance Method Details
#execute(*args) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/cucumber/core/test/action/defined.rb', line 26 def execute(*args) @timer.start @block.call(*args) passed rescue Result::Raisable => e e.with_duration(@timer.duration) rescue Exception => e failed(e) end |
#inspect ⇒ Object
36 37 38 |
# File 'lib/cucumber/core/test/action/defined.rb', line 36 def inspect "#<#{self.class}: #{location}>" end |
#skip ⇒ Object
22 23 24 |
# File 'lib/cucumber/core/test/action/defined.rb', line 22 def skip(*) skipped end |