Test/spec + mocha On Sep 16, 2007, at 8:44 AM, "Pat Maddox" <[EMAIL PROTECTED]> wrote:
> On 9/16/07, Jay Levitt <[EMAIL PROTECTED]> wrote: >> 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 >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > Bummer. > > Since you've been doing TDD the right way this whole time, hopefully > you'll be able to maintain (and teach) what you've learned. It might > be uncomfortable or painful at first but I'm sure you can do it. > > I'm interested to know how your Test::Unit style might have changed > after using RSpec for a while. I'm also interested to know if you > "slip" back to your older, different style (if there was one). > > Pat > _______________________________________________ > 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