| I've been using Minitest, Mocha, and RR lately after using Rspec for many years, and find myself really missing Rspec. At a high level, I would say that Rspec is just much more thought out. The other libraries all seem to be written by someone who looked at Rspec and though "Ugh, this is too much. I just need X." But I find, if I'm doing serious TDD, I'm gonna need pretty all of Rspec. And what happens is that the other libs just don't integrate that well. For example, you may be using one test runner (minitest) with a mock from some other library (mocha) and assertions from a third (test::unit). The question is: are those things all meant to work well together? Are your mocks scoped correctly within your test runner? Is your database cleaner working properly with your before and after hooks? The answer is sometimes "no". But with Rspec, everything works well together. It just fits. Generally I'm a big fan of focused libraries, loosely coupled. But the state of things with testing is that I don't think we've yet found that good loose coupling. The second issue is that Rspec just seems to have much richer assertions. I can do things like: expect {
delete_zombie_users
}.to change(User, :count).by(-1)
Or: thingy.length.should < 4
And mocking is also underdeveloped in other libs. Mocha, for example, can't stub constants. In Rspec I can do: User.stub(:all => [fred, betty, sue])
Or stub_const("File::MAX_SIZE", 10**10)
And it works great. I find I can easily stub out parts of ActiveRecord and write good targetted unit tests. With Mocha I find myself using any_instance all the time because I can't target things on the structure I really want to target them to.Some of these are available in other expectation libraries, but I've found Rspec to have a really nice, comprehensive set of them. All in all, I just feel like David Chelimsky and the Rspec folks have really thought about testing in a way the other libs' authors haven't. I keep learning things about TDD and finding out that Rspec has already considered them. With other libs the opposite often seems true. |