Class: Cucumber::Core::Test::Action
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Action
- Defined in:
- lib/cucumber/core/test/action.rb
Direct Known Subclasses
Instance Method Summary collapse
- #execute(*args) ⇒ Object
-
#initialize(location = nil, &block) ⇒ Action
constructor
A new instance of Action.
- #inspect ⇒ Object
- #location ⇒ Object
- #skip ⇒ Object
Constructor Details
#initialize(location = nil, &block) ⇒ Action
Returns a new instance of Action.
11 12 13 14 15 16 |
# File 'lib/cucumber/core/test/action.rb', line 11 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 Method Details
#execute(*args) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/cucumber/core/test/action.rb', line 22 def execute(*args) @timer.start @block.call(*args) passed rescue Result::Raisable => exception exception.with_duration(@timer.duration) rescue Exception => exception failed(exception) end |
#inspect ⇒ Object
36 37 38 |
# File 'lib/cucumber/core/test/action.rb', line 36 def inspect "#<#{self.class}: #{location}>" end |
#location ⇒ Object
32 33 34 |
# File 'lib/cucumber/core/test/action.rb', line 32 def location @location end |
#skip ⇒ Object
18 19 20 |
# File 'lib/cucumber/core/test/action.rb', line 18 def skip(*) skipped end |