Skip to content

Commit

Permalink
Exit with error when one appraisal fails
Browse files Browse the repository at this point in the history
  • Loading branch information
jferris committed Nov 11, 2010
1 parent ff75e90 commit dcd72fe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
18 changes: 18 additions & 0 deletions features/appraisals.feature
Expand Up @@ -28,6 +28,11 @@ Feature: run a rake task through several appraisals
require 'factory_girl'
puts "Loaded #{Factory::VERSION}"
end
task :fail do
require 'factory_girl'
puts "Fail #{Factory::VERSION}"
raise
end
task :default => :version
"""
When I successfully run "rake appraisal:install --trace"
Expand Down Expand Up @@ -55,3 +60,16 @@ Feature: run a rake task through several appraisals
Then the output should contain "Loaded 1.3.0"
And the output should contain "Loaded 1.3.2"

@disable-bundler
Scenario: run a failing task with one appraisal
When I run "rake appraisal:1.3.0 fail --trace"
Then the output should contain "Fail 1.3.0"
And the exit status should be 1

@disable-bundler
Scenario: run a failing task with all appraisals
When I run "rake appraisal fail --trace"
Then the output should contain "Fail 1.3.2"
But the output should not contain "Fail 1.3.0"
And the exit status should be 1

6 changes: 5 additions & 1 deletion lib/appraisal/command.rb
Expand Up @@ -16,7 +16,11 @@ def initialize(command, gemfile = nil)

def run
announce
with_clean_env { Kernel.system(@command) }
with_clean_env do
unless Kernel.system(@command)
exit(1)
end
end
end

def exec
Expand Down

0 comments on commit dcd72fe

Please sign in to comment.