-
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.
Merge pull request #25 from codegram/feature/exit_code
Feature/exit code
- Loading branch information
Showing
8 changed files
with
106 additions
and
10 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 |
---|---|---|
|
@@ -6,4 +6,4 @@ rescue LoadError | |
require_relative '../lib/spinach' | ||
end | ||
|
||
Spinach::Cli.new(ARGV).run | ||
exit Spinach::Cli.new(ARGV).run |
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,14 @@ | ||
Feature: Exit status | ||
In order to receive a standard exit code | ||
As a developer | ||
I want spinach to return exit status properly | ||
|
||
Scenario: It succeeds | ||
Given I have a feature that has no error or failure | ||
When I run it | ||
Then the exit status should be 0 | ||
|
||
Scenario: It fails | ||
Given I have a feature that has a failure | ||
When I run it | ||
Then the exit status should be 1 |
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,50 @@ | ||
require 'aruba/api' | ||
|
||
Feature "Exit status" do | ||
include Integration::SpinachRunner | ||
|
||
Given "I have a feature that has no error or failure" do | ||
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', | ||
'Feature "A success feature" do | ||
Then "I succeed" do | ||
end | ||
end') | ||
@feature = "features/success_feature.feature" | ||
end | ||
|
||
Given "I have a feature that has a failure" do | ||
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', | ||
'Feature "A failure feature" do | ||
Then "I fail" do | ||
true.must_equal false | ||
end | ||
end') | ||
@feature = "features/failure_feature.feature" | ||
end | ||
|
||
When "I run it" do | ||
run_feature @feature | ||
all_stdout # Hack to get a correct exit status | ||
end | ||
|
||
Then "the exit status should be 0" do | ||
last_exit_status.must_equal 0 | ||
end | ||
|
||
Then "the exit status should be 1" do | ||
last_exit_status.must_equal 1 | ||
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
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