Agile practices have pushed software engineers towards test driven development. The result has been an increase in project velocity and general happiness all around. However, at some point you will get a project that either lacks tests or has insufficient test coverage. Even on projects that have 100% coverage bugs will still manifest themselves. For…
Tag: testing
Interesting testing issue with Rails 2.3.3
I’m not sure if this applies to all the versions of Rails, but right now I’m using the latest 2.3.3. I’m using shoulda to do testing and my code looks like this: context “GET show” do setup do @feed = Factory(:feed) get :show, :id => @feed.to_param end should_not_set_the_flash should_respond_with :success should_render_template :show end </pre> The…
Using Shoulda to test login – should_require_login
I’ve had my problems with shoulda, but one very powerful component of the testing framework is the ability to create macros. Here’s one that checks to make sure a user has to be logged in to access an action. Put it into test/shoulda_macros/authentication.rb. (You can name the file anything you want I just thought authentication.rb…
Tip for Testing Email with Ruby on Rails and Shoulda
Shoulda comes with a great method for testing email called ‘assert_sent_email’. (If you try it and get a method missing error update Shoulda. Not that anyone wouldn’t know to just do that). No matter what you use to test email as long as you are in test mode your emails will be placed into an…
Setting up ZenTest and Red Green
I can’t take credit for any of these instructions. Dave South from the Logan Ruby group sent these out in an email. I am posting them so that I can find them later on. Install ZenTest: sudo gem install ZenTest</pre> Then install RedGreen sudo gem install redgreen</pre> Go to your rails project directory and create…