Testing without the database

We’ve been embracing the whole testing without the database for our unit tests, making use of unit_record. However, with a recent update I found a lot of my tests failing. I eventually narrowed it down to something to do with query caching. Well, apparently query caching only gets activated if there are ActiveRecord configurations, so, since we aren’t using the database anyway, it should be okay to clear the configuration for our unit tests - right?

Well, it was, and this is what I put in my unit_test_helper file:

# Clears active record configurations since we don't need them
# (and they cause query cache problems)
ActiveRecord::Base.configurations.clear
Found this interesting? Share it:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • description
  • Furl
  • Ma.gnolia
  • NewsVine
  • Reddit
  • TwitThis

Leave a Reply