Jake Scruggs

writes ruby/wears crazy shirts

I loves me some RSpec, but I’ve had this consistent problem on my last two projects when RSpec and Rcov are run together: Sometimes you get Seg Faults. In a previous post I talked about my solution to this (redefining the new method on ActiveRecord objects), but it was a hacky solution and I’m glad to say that it’s out of the code base as of today. On a hunch this weekend I installed RSpec 0.8.2 (we had been using 0.7.5.1), took out my super-fun hacktacular solution from a spec and it ran fine.

But why?

Looking through RSpec’s list of bugs fixed I didn’t see any reference to the bug I logged a few months ago (I didn’t really expect too – they were never able to reproduce it) but I do have any idea. David Chelimsky (lead dev of RSpec) had been telling me for awhile about how he was going to change RSpec to stop using method_missing on object because when Rails takes it for its own purposes, then RSpec has to some hacky things to steal it back (David wrote about it in "rspec.should use_a_little_less_magic"and so did I in "Battle of the method_missings"). Since the removal of that code was the big change between 0.7.5.1 and 0.8.2, I’m gonna guess that it was the problem.

4 comments :

Clint said...

Actually, I believe I saw RCov had in its latest release notes "Now plays nice with RSpec."

Obie said...

Yeah, Clint is right. Zed fixed the problem (in RCov's C code) and contributed it back to the project.

Jake Scruggs said...

Hey -- good to hear from you guys.

Oh that Zed, can he do no wrong? The weird thing is that we haven't changed to the latest version of RCov. Odd that.

David Chelimsky said...

Also, method_missing is still on Object and will be until 0.9. We introduced the new mechanism and deprecated the old, but have yet to remove it.