Loading

Fix for Spork Not Reloading Models with Rails 3

So spork is pretty cool and makes running a single test a lot less painful. It loads up a rails environment and just forks each time you want to run a test instead of the standard way where it loads the entire rails environment to run one test.

But I had a problem that it was never reloading any models that changed. After much investigating, it turned out that the line

fixtures :all

in test_helper.rb was making all the models get loaded prefork, thus never get reloaded.

Remove that line and add the fixtures call to your individual tests. Kind of a pain, but much faster in the long run. As long as you are loading fixtures in each test, you can only load the ones you need to speed things up a little.


Related Posts

  1. iPhone/iPad UISearchBar and UISearchDisplayController Asynchronous Example
  2. High Availability on a Shoestring -- MMM Mysql Multi-master Replication Manager
  3. High Availability on a Shoestring -- Postgresql 9.0 Streaming Replication
  4. golang Makefiles
  5. High Availability on a Shoestring -- Database Replication and Failover Alternatives
You should follow me on Twitter: @patrickxb