This post originated from an RSS feed registered with Ruby Buzz
by Andrew Montgomery.
Original Post: Testing without the database
Feed Title: Dark Liquid - Ruby
Feed URL: http://feeds.feedburner.com/DarkLiquid-Ruby
Feed Description: Ruby and Rails related ramblings by Andrew Montgomery
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