RSpec, minitest, cukes & friends
I followed the discussion on Twitter after David Heinemeier Hansson declared his dislike for rspec and similar testing frameworks. This is nothing new but this time he was pissed off by some code snippet he was working on. I’ve read several interesting answers and the general consensus seems to be that there is not an absolute “right” way to spec-out features. Agree.
I always used RSpec (except for an RR parenthesis I wasn’t happy about) but these days I’m more inclined to go the simplest route, that is for Rails the included Test::Unit and integration test capabilities. Also outside Rails I’m more inclined to use Test::Unit/minitest which comes for free with Ruby 1.9. What is pushing me away from RSpec is the lack of consistency in the DSL release after release.
New keywords are introduced constantly which most of the time are equivalent ways to express the same construct. I think this is David Chelimsky tying to integrate all the good suggestions coming from the community. Although I appreciate his effort, the final result for me is that I struggle to read specs written by someone else unless I learn the new syntax. The other problem is that working on different projects with different RSpec versions I often can’t remember what style I can use. Embellishments to RSpec aren’t for sure a bad thing except when the DSL becomes a moving target and the changes introduced can’t be considered definitive “improvements” but different ways to name the same thing. I’d rather prefer David to be much more opinionated about RSpec, for the good and for the bad.
I have the impression that with Cucumber, Capybara, RSpec and the incredible number of other frameworks we are pushing the need for testing way too far. It’s like we “rubysts” are trying to demonstrate where we can push a DSL for testing thanks to the language expressiveness, which is an useful not business-related exercise. There are of course use cases for all of the above frameworks, but the community effort in the direction of testing frameworks seems disproportionate.
1 year ago