Category Archives: Test Driven Development (TDD)

MySQL Triggers w/Rails

I recently incorporated db-triggers with a Rails app to maintain some counts that were otherwise fairly expensive to retrieve.  Rails wasn’t super-pumped about the idea (what with the “keep all the logic in the app” approach and all), but sometimes… you … Continue reading

Leave a Comment

Filed under deployment, rails, Ruby, SQL, Test Driven Development (TDD)

Receiving Email with ActionMailer

This really was a snap. A nice and simple testing recipe (#68) demonstrates how to read in an email from a fixture in just a few lines and pass them to your processing method (MailReceiver.receive in this case). def read_fixture(action) … Continue reading

Leave a Comment

Filed under Email, rails, Ruby, Test Driven Development (TDD)

Be careful with assert_not_equal

As I discovered today, assert_not_equal has a pretty big problem: it does exactly what you ask it to do. I just need to make sure that a user has at least one record: assert_not_equal 0, UserPreference.find_by_user_id(user_id) As you may have … Continue reading

2 Comments

Filed under rails, Ruby, Test Driven Development (TDD)

Adding tests to rake

We’ve developed a few batch applications that live in the same directory structure as the Rails app they’re intimate with. So, the lib/foo/test/ contains some tests for the ‘foo’ batch app. lib/bar/test has the ones for ‘bar’ etc. It was … Continue reading

Leave a Comment

Filed under rails, Ruby, Test Driven Development (TDD)

No help from the log

Upon synching up, a colleague noticed that I had a test failing… kinda odd since I've been (trying to be) pretty good about keeping things up to date. Running them myself, we noticed that I was actually experiencing a quiet … Continue reading

Leave a Comment

Filed under rails, Ruby, Test Driven Development (TDD)

Requiring and Testing Cookies

Requirement: Users must have cookies enabled to use the site. If they don't: give them some sort of graceful warning to let them know there's going to be trouble. Doesn't sound too bad… it ended up being much more of … Continue reading

6 Comments

Filed under Cookies, rails, Ruby, Test Driven Development (TDD)

Testing the controller

A couple things I found very handy today while setting up a functional test for a controller. First off, this controller relies on a user being logged in (but this isn't the controller that actually manages the login process). The … Continue reading

Leave a Comment

Filed under Agile Software Dev, rails, Ruby, Test Driven Development (TDD)