-
-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pick up failure on after hook [#272 state:resolved]
- Loading branch information
1 parent
50957da
commit a5ca545
Showing
8 changed files
with
118 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@intentional_failure | ||
Feature: Hooks | ||
In order to integrate with my complex environment | ||
I need to check scenario status in an After block | ||
|
||
@272_failed | ||
Scenario: Failed | ||
Given I fail | ||
|
||
@272_undefined | ||
Scenario: Undefined | ||
Given I am undefined | ||
|
||
@272_passed | ||
Scenario: Passed | ||
Given I pass | ||
|
||
@272_outline | ||
Scenario Outline: Should work too | ||
Given <something> | ||
|
||
Examples: | ||
| something | | ||
| I fail | | ||
| I am undefined | | ||
| I pass | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
require 'spec/expectations' | ||
|
||
Given /^I fail$/ do | ||
raise "BOOM (this is expected)" | ||
end | ||
|
||
Given /^I pass$/ do | ||
end | ||
|
||
module HookChecks | ||
def check_failed(scenario) | ||
scenario.should be_failed | ||
scenario.should_not be_passed | ||
scenario.exception.message.should == "BOOM (this is expected)" | ||
end | ||
|
||
def check_undefined(scenario) | ||
scenario.should_not be_failed | ||
scenario.should_not be_passed | ||
end | ||
|
||
def check_passed(scenario) | ||
scenario.should_not be_failed | ||
scenario.should be_passed | ||
end | ||
end | ||
|
||
World(HookChecks) | ||
|
||
After('@272_failed') do |scenario| | ||
check_failed(scenario) | ||
end | ||
|
||
After('@272_undefined') do |scenario| | ||
check_undefined(scenario) | ||
end | ||
|
||
After('@272_passed') do |scenario| | ||
check_passed(scenario) | ||
end | ||
|
||
counter = 0 | ||
After('@272_outline') do |scenario| | ||
case(counter) | ||
when 0 | ||
check_failed(scenario) | ||
when 1 | ||
check_undefined(scenario) | ||
when 2 | ||
check_passed(scenario) | ||
end | ||
counter +=1 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters