On 8 July 2010 01:01, David Chelimsky <dchelim...@gmail.com> wrote: > On Jul 7, 2010, at 8:22 AM, Andrew Premdas wrote: > > > 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? > > The initial motivation was that it makes it easy to make sure it works > whether you run it with the ruby command or the rspec command. Over the > years it has caused some trouble though, so I'd be interested in a different > solution. > > > 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. > > I added RSpec::Core::Runner.disable_autorun! to beta.16 in order to solve a > similar problem. No guarantees it will stay there if I come up with a better > way to deal with supporting multiple entry points, but if I remove it I'll > formally deprecate it (so you're safe to use it). > > HTH, > David > > Thanks for your reply David. Does this only apply only to rspec2? (the beta 16 seems a bit of a giveaway). Is there something I can do with rspec 1x. I've tried commenting out require 'spec/autorun', but that had no effect. Is there is something I could do like put a monkey patch in spec helper.
On a related note, can rspec 2 be used on rails 2x projects All best Andrew > > > TIA > > > > Andrew > > _______________________________________________ > > rspec-users mailing list > > rspec-users@rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users