Skip to content

Instantly share code, notes, and snippets.

@gbp
Created March 14, 2014 10:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbp/9545526 to your computer and use it in GitHub Desktop.
Save gbp/9545526 to your computer and use it in GitHub Desktop.
rspec with zeus and spork
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