Not. We have spork in our specs assistant, and we donβt use it much time, since it slows down tests in general for larger suites. We only run spork if we quickly iteratively execute a small subset of the tests during TDD. When spork does not work, we simply do not pass the --drb parameter to RSpec, and everything works without Spork. There is an obvious Spork, but it is not used unless we run it and run our specifications with --drb .
If you do not need preprok blocks there, you must set the environment variable before its execution, so you can conditionally bypass them if they cause you a problem.
EDIT | I just split our specification assistant into several files, so the preview block does not load at all when we do not start Spork. This is not necessary, but here is how I did it.
spec_helper.rb loads one of two different files after performing a quick environment check)
ENV["RAILS_ENV"] ||= 'test' # Conditional Spork.prefork (this comment is needed to fool Spork `bootstrapped?` check) if /spork/i =~ $0 || RSpec.configuration.drb? require File.expand_path("../spec_helper_spork", __FILE__) else require File.expand_path("../spec_helper_base", __FILE__) end
spec_helper_base.rb is just a copy of the original spec_helper without Spork (you can just rename it back if you delete Spork)
ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'database_cleaner'
And finally, spec_helper_spork.rb is just a wrapper around spec_helper_base.rb
require 'spork' Spork.prefork do require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'database_cleaner' end Spork.each_run do $rspec_start_time = Time.now require File.expand_path("../spec_helper_base", __FILE__) end
Only spec_helper_spork.rb time is loaded if you:
a) Call the spork command b) Run your specifications with the --drb option
This works great for me. I cannot stress enough that this is not necessary. Your specs will work fine without running spork unless you pass the --drb option anyway. I like that now he is completely disconnected from our specifications assistant, although I did.