Let a human test your app, not (just) unit tests
I’m a big believer in unit testing. We unit test our Rails apps extensively, and we’ve done so for years. On some projects, we do both unit testing and integration testing using Cucumber. I preach unit testing to everyone I can. I’d...
Building a Video Delivery Network in 48 hours
Last weekend, I participated in my first Rails Rumble. Rails Rumble is a 48-hour app building contest. We started from scratch Friday evening – you can have concepts and notes on paper, but no code or digital UI assets – and stopped Su......
ActiveRecord refererential integrity is broken. Let’s fix it!
ActiveRecord supports cascading deletes to preserve referential integrity:
1
2
3
class User
has_many :posts, :dependent => :destroy
end
But you really only want cascading deletes about half the time. The other half, you wa...
Rails 2.3.3 upgrade notes: rack, mocha, and _ids
I upgraded two apps to Rails 2.3.3 today. It’s a minor release, and there’s not much to report. But I did run into three minor problems.
Mocha
Mocha 0.9.5 started throwing an exception:
NameError: uninitialized constant Mocha:...
Estimating software: a rule of thumb
Estimating software is hard, but most of us have to do it – whether we’re estimating an entire project for a client, or a new feature for a boss, or a change to one of our own projects.
I’ve found the following rule...
Music and programming: interviews with Chad Fowler and Dave Thomas
I’ll be speaking at RailsConf 2009 this year on music and software development (Five musical patterns for programmers). The basic premise is that software development and music actually have quite a bit in common. This may be surprising ...
Anonymize sensitive data with rake
When troubleshooting a nasty bug, it’s often useful to take a look actual production or staging data, or even pull it down into your development database. But this is a huge potential privacy and security concern. Your local environment ...
Benchmarking your Rails tests (updated)
Update: stubbing a single integration point shaved 22 seconds off of my unit tests, reducing test time from 35 seconds to 13. See below.
The first step to faster tests is knowing what is slow. Fortunately, this is dead simple with the t...
Slow tests are a bug
I’ve been doing TDD for about three years now. Once I figured out how to do it right, it became a natural part of how I program, and I can’t really imagine doing development without it. This isn’t to say that TDD is...
Rescuing autotest from a conflicting plugin
For the longest time, I wasn’t able to run autotest on one of my projects. That was OK; I was intrigued by autotest, but had never really committed to it. The problem: whenever I would try to run autotest, I’d get the following...

