This is an experiment for possible faster boot time (and consequently faster feedback) when running tests. I ask your help to try this in your apps (any Rails 3.x app) and let me know how well it works.
Add the following lines inside the configuration block in config/environments/test.rb
:
config.cache_classes = true
def eager_load!; end
Notice that config.cache_classes
needs to be true (which is the default), some tools may not be fine that. Needless to say, just do this for test environments.
The following two benches will work only for rspec running from the command line (hopefully you don't use rake to run your specs):
-
Pick up a spec file that runs all specs under 1s (for example, a file under spec/models or spec/helpers). Run the command below before and after you apply the
eager_load!
patch above (the bigger your application, the faster it should boot after you apply the patch):time rspec spec/models/SOME_MODEL_spec.rb
-
Try running your whole suite with and without the patch. In this case, you shouldn't see any perf difference and everything should work just fine (report if it doesn't!).
Let me know how 1) and 2) goes in the comments section below.
Single spec
Whole suite
(first number is what RSpec reports, second is from
time
)