Open Dagnan opened 13 years ago
Had the same issue here. Tryed every jujitso/workaround/patch myself thing to make spork 0.8.5 work w/o luck. That one ([Rails.root, 'models/*.].each(&load.....) I call the load'em all, and its a bad idea! You'll get that double errors and plus some other glitches with "cache_classes = true" in test enviroment (fabrication and machinist don't behave nicely that way).
Try spork 0.9.0.rc9, it's all working perfect here, models reloading and no bugs, I dunno why (yet, just found out heh). Just did the trap load_models of mongoid.
I'm already using 0.9.0.rc9 :/
Oh, sorry Dagnan, missed the "spork last rc".
Here's my spec_helper:
https://gist.github.com/1289242
Just to confirm: that's finally reloading my models and no glitches in rails 3.1.1, with cache_classes = true. (besides bugs, cache_classes = false makes my 30s suite take 2:00 to run! major pita.
First, spork -d shows only config files so models are not preloaded. I'm also using Spork with Test:Unit (actually Minitest, last version from Rubygems), Rails 3 (with Spork last rc) and Ruby 1.9.2.
I had to put a load instruction for all my models in Spork#each_run because not all files under /app/models where loaded (I have subdirectories).
But the behavior I get is when my models is invalid, errors are duplicates:
For now if I reload only models from /models subdirectories I get the expected behavior. But this is kind of ugly.