I am currently using Spork with Guard, Rspec, and Cucumber. I'd like to move to Spring, but can't find any documentation on what I need to change.
Specifically, I'm curious if I need to change out my:
require 'spork'
Spork.prefork do
# ...
end
Spork.each_run do
# ...
end
...with something like:
require 'spring'
Spring.prefork do
# ...
end
Spring.each_run do
# ...
end
However, I know that there isn't a Spring.prefork because the documentation says so. So should I simply remove the references to Spork or do I need to replace them with something?
As you mention in your question, there is no Prefork block. The docs provide a workaround: simply move your existing
Spork.preforkblock to an initializer or anywhere that it will be picked up and run at load time by Rails.From https://github.com/rails/spring#running-code-before-forking:
As for your
Spork.each_runblock, since you're using Rspec you could move it into abefore(:suite)block. See the Rspec docs on before and after hooks