[rspec-users] I lost the RSpec fight
Jay Levitt
lists-rspec at shopwatch.org
Sun Sep 16 09:38:50 EDT 2007
I've been working on a Rails project with one other developer; he was
using Test::Unit, and I was using RSpec. That works OK for a while, but
obviously it starts causing pain when you have to check in two places to
see if a piece of code is properly tested/spec'd, you can't use TextMate
shortcuts to switch back and forth between code and test, you have to
duplicate shared behaviors/test helpers, etc.
So when we brought in a consulting team to add some manpower, we
realized we had to switch to a single framework. This is a team that's
fairly experienced with Rails and active in the Rails community, but was
quite opposed to choosing RSpec.
Here are the arguments I heard against unifying on RSpec:
* Test::Unit is ubiquitous. Everyone knows it. This is hard to
counter; it comes with Rails and is the default. Same reason many
people use Prototype even though JQuery/dojo might suit them better.
* For that reason, it's a lot easier to find examples of "how to do
something" in Test::Unit than in RSpec. That's true; several times I've
had a bit of code that didn't fall nicely into the MVC hierarchy, and I
wasn't sure how to build up the right context to test it in. If I were
using Test::Unit, I could just copy the equivalent tests from Rails
core, but using RSpec I had to roll my own.
* RSpec is BDD (hand-waving new different troublesome); we do TDD.
We've covered that ground on this list many times; BDD is an extension
and interpretation of TDD, not some newfangled crackpot theory. But
people don't know that.
* The team had in fact investigated RSpec a few months ago, and decided
they didn't like it. Some of what they didn't like has been fixed in
1.0, but of course people aren't going to come running to re-examine
each release, so the bitter taste remained:
* #context was defined on Kernel. Not sure if that's still true for
#describe.
* Not compatible with tools that expect Test::Unit output. This
would(could) be fixed with the runner integration that's been discussed.
* Wasn't compatible with mocha/FlexMock. Fixed now.
But again, it came back to ubiquity, which is a pretty hard problem to
overcome.
Seems to me that the best way to get RSpec adopted is to find some more
visible, prolific plugin programmers and evangelize them to start using
RSpec, so it's not some "neat fringe thing", but a solid, respectable
alternative to Test::Unit.
Jay Levitt
More information about the rspec-users
mailing list