How I avoid finding myself in database bizarro world while testing Rails apps.
NullDB, for those who don’t know, is a null backend for ActiveRecord. Unlike RSpec’s stub_object, rather than raise an exception on DB access, will NullDB DB interactions simply become no-ops. This is handy for things like testing after_save hooks in isolation. Myron Marston has done a stellar job shepherding it through the Rails 3 transition, but […]
The first Ruby library I ever released, and still the one I get the most emails about, is NullDB. NullDB is an ActiveRecord database adapter which simply turns every database operation into a no-op. It is useful for speeding up tests which don’t rely on the database, as well as verifying that they are, in […]