A Rails HOWTO: Simplify Your Unit Tests
So you’ve spent a few weeks writing your Ruby on Rails application, and then you realize you’ve been spending all of your time learning about this awesome language and web development framework, and all of the automagically generated unit tests that Rails makes for you are really just stubs. Damn. You sit down and start coding, but you realize you’re writing variations on a theme: check to see if a model creates/updates/destroys correctly, etc. etc. You remember something DHH said about a TLA… that’s right! DRY!
So in the giving spirit of the ancient holiday of “Hey Where The Hell Did The Sun Go Goddamnit,” here are a few useful and flexible helper methods for streamlining those unit tests.
4 comments »