[rspec-users] RSpec uses at_exit - forks and stuff

Andrew Premdas apremdas at gmail.com
Wed Jul 7 09:22:38 EDT 2010


Hi there.

My understanding (which is limited) is that rspec uses at_exit to run its
specs. I don't really know why - could somoene explain?

My problem with this behaviour is that I would like the running of a spec to
start an instance of solr (using Sunspot) if one is not running. The problem
with this is that Sunspot forks to start solr, and when these forks exit
they run my specs. At best this causes specs to be run more than once, at
worst it causes specs to fail in their hundreds.

I can fix this by adding an at_exit for each fork ...

    fork do
      ...
      at_exit { exit! }
    end

but this means changing the Sunspot code, which I really shouldn't have to
do to run specs. So is their anything else I can do. Ideally in spec_helper
or another rspec support file.

TIA

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100707/21fa0378/attachment.html>


More information about the rspec-users mailing list