Spork doesn't reload 'some' models

Hi everyone.

I’ve been using spork+guard+rspec with great happiness in my latest
projects, but yesterday I came across to a wired bug I can’t really
understand and where I’ve spent the whole morning trying to figure out
what was going wrong.

Let me explain. I’ve making unit test to my models. When I apply changes
to the spec files they are correctly reloaded and new changes are seen.
All fine. When I apply changes to the model file they are not reloaded
and the tests runs with the version initially loaded (when spork
starts), not the changed one (the last one I would need). This cause me
to restart spork every time, loosing its benefices and my patience.

To make this even wired, one model out of seven works correctly. This
means that for one model, if I change its code, it is loaded correctly
and the test suite runs with the last version of it. This behavior at
the beginning was’t there, and it started to act like this only
yesterday. If I go back to a version of the project of 3 days ago,
models that now are not reloaded, where working correctly with spork.

I tried different solutions

  • checked out preloaded files with spork --diagnose. Models are not
    preloaded, which is good.
  • tried to force the model load in the spec file using require,
    require_dependencies and load. Nothing to do.

I’m running out of idea, I guess mainly due my lack of knowledge on the
rails workflow. Models seems to be saved (some of them) and not reloaded
even when forcing it. I would love to have some hints or some
suggestions on this problem. I can move forward, but it makes me totally
crazy, because I can’t see why it has a “non deterministic” behavior (at
least from what I saw till now).

Thanks in advance.