Skip to content

Commit

Permalink
Test showing World is inconsistently available in Around hook
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlinc authored and tooky committed Mar 18, 2015
1 parent eb950d1 commit 25e19a5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions features/docs/writing_support_code/around_hooks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,34 @@ Feature: Around hooks
2 steps (2 passed)
"""

Scenario: Around Hooks and the Custom World
Given a file named "features/step_definitions/steps.rb" with:
"""
Then /^the world should be available in the hook$/ do
$previous_world = self
expect($hook_world).to eq(self)
end
Then /^what$/ do
expect($hook_world).not_to eq($previous_world)
end
"""
And a file named "features/support/hooks.rb" with:
"""
Around do |scenario, block|
$hook_world = self
block.call
end
"""
And a file named "features/f.feature" with:
"""
Feature: Around hooks
Scenario: using hook
Then the world should be available in the hook
Scenario: using the same hook
Then what
"""
When I run `cucumber features/f.feature`
Then it should pass

0 comments on commit 25e19a5

Please sign in to comment.