How do I get spork to reload my shared examples when I make changes to them? I tried the following, but it's not reloading them:
Spork.each_run do
Dir[Rails.root.join("spec/shared_examples/*.rb")].each {|f| require f}
end
I know that I can add a watcher to my Guardfile to have it reload the env when the shared examples change, but my application is big and takes about 10-15 seconds to reload the entire environment:
watch(/^spec\/shared_examples\/.*\.rb$/)
I would prefer to just have it reload the shared examples that changed though so I can have a faster feedback loop.
Turns out I was also loading the shared_examples in Spork.prefork, and for some reason that was causing them not to reload for each run. Removing that line from Spork.prefork and only having it in Spork.each_run fixed the issue and now changes to any shared_examples are reflected any time a test runs.