Created
April 28, 2011 06:38
-
-
Save aaronjensen/945912 to your computer and use it in GitHub Desktop.
run rspec in a fork off rake to prevent loading the rails environment again
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
# /lib/tasks/rspec.rake | |
namespace :fork do | |
task :spec do | |
fork do | |
RSpec::Core::Runner.disable_autorun! | |
RSpec::Core::Runner.run(['spec'], $stderr, $stdout) ? exit(0) : exit(1) | |
end | |
Process.wait | |
raise 'rspec failed' unless $?.exitstatus == 0 | |
# exiting the fork can cause MySql to drop the connection | |
# but AR doesn't notice. This mitigates. | |
ActiveRecord::Base.connection.reconnect! if ActiveRecord::Base.connected? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment