I am using the “faster_helper” to avoid loading the Rails (3.2.6) environment when I’m working on a single test file.
So I often just declare dummy class (which in reality is AR model) like so:
class User; end
This gives me very fast test runs and no dependencies on Rails env.
But when I run the full suite this behaviour is broken because Rails doesn’t autoload the User model since the class/constant has already been declared.
The proposed solution was to call Rails.application.eager_load! somewhere before the specs are run.
And I do it this way:
The problem is that some of the classes that I require are loaded twice. Thus giving a warning like:
warning: already initialized constant MIN_NO_CASH_FLOW_PERIODS
It isn’t huge issue ATM, but it’s no good either.
Is there anything you can see I am doing wrong? How can this be “fixed”?