Skip to content

Commit

Permalink
Add another scenario for step def trick
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwynne committed Nov 8, 2012
1 parent f24126e commit 7aae29d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions features/step_definitions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,34 @@ Feature: Step Definitions
Then the action should be done
"""

Scenario: Call a method on an actor in the World directly from a step def
Given a file named "features/step_definitions/steps.rb" with:
"""
class Thing
def do_action
@done = true
end
def assert_done
@done.should be_true
end
end
module Driver
def thing
@thing ||= Thing.new
end
end
World(Driver)
When /I do the action to the thing/, :do_action, :to => lambda { thing }
Then /The thing should be done/, :assert_done, :to => lambda { thing }
"""
And a file named "features/action.feature" with:
"""
Feature:
Scenario:
When I do the action to the thing
Then the thing should be done
"""

0 comments on commit 7aae29d

Please sign in to comment.