-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
75 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ test/version_tmp | |
tmp | ||
capybara-*.html | ||
Gemfile.lock | ||
tags |
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,10 @@ | ||
Feature: Fail fast option | ||
In order to save running time | ||
As a developer | ||
I want spinach to fail fast when I so desire | ||
|
||
Scenario: fail fast | ||
Given I have a feature that has a failure | ||
Given I have a feature that has no error or failure | ||
When I run both of them with fail-fast option | ||
Then the tests stop at the first one |
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,21 @@ | ||
class Spinach::Features::FailFastOption < Spinach::FeatureSteps | ||
include Integration::SpinachRunner | ||
|
||
step 'I have a feature that has a failure' do | ||
@features ||= [] | ||
@features << Integration::FeatureGenerator.failure_feature | ||
end | ||
|
||
step 'I have a feature that has no error or failure' do | ||
@features ||= [] | ||
@features << Integration::FeatureGenerator.success_feature | ||
end | ||
|
||
step 'I run both of them with fail-fast option' do | ||
run_feature @features.join(" "), append: '--fail-fast' | ||
end | ||
|
||
step 'the tests stop at the first one' do | ||
@stdout.must_match("(0) Successful") | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module Integration | ||
class FeatureGenerator | ||
class << self | ||
include Filesystem | ||
|
||
def success_feature | ||
write_file('features/success_feature.feature', """ | ||
Feature: A success feature | ||
Scenario: This is scenario will succeed | ||
Then I succeed | ||
""") | ||
write_file('features/steps/success_feature.rb', | ||
'class ASuccessFeature < Spinach::FeatureSteps | ||
feature "A success feature" | ||
Then "I succeed" do | ||
end | ||
end') | ||
"features/success_feature.feature" | ||
|
||
end | ||
|
||
def failure_feature | ||
write_file('features/failure_feature.feature', """ | ||
Feature: A failure feature | ||
Scenario: This is scenario will fail | ||
Then I fail | ||
""") | ||
write_file('features/steps/failure_feature.rb', | ||
'class AFailureFeature < Spinach::FeatureSteps | ||
feature "A failure feature" | ||
Then "I fail" do | ||
true.must_equal false | ||
end | ||
end') | ||
"features/failure_feature.feature" | ||
end | ||
end | ||
end | ||
end |