Created
March 14, 2014 10:43
-
-
Save gbp/9545526 to your computer and use it in GitHub Desktop.
rspec with zeus and spork
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
require 'rubygems' | |
prefork = lambda { | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
} | |
each_run = lambda { | |
... | |
} | |
if defined?(Zeus) | |
prefork.call | |
$each_run = each_run | |
class << Zeus.plan | |
def after_fork_with_test | |
after_fork_without_test | |
$each_run.call | |
end | |
alias_method_chain :after_fork, :test | |
end | |
elsif defined?(Spork) | |
require 'spork' | |
Spork.prefork(&prefork) | |
Spork.each_run(&each_run) | |
else | |
prefork.call | |
each_run.call | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment