Faster tests - GeoHealth/HAppi_backend GitHub Wiki
I tried to make test run faster. Because on Windows it is so slow, I use a VM running Ubuntu.
direnv
In this VM, there is direnv installed.
Based on the .envrc
file, it enhance the PATH with bin
folder.
This is needed because I use Spring to speed up environment loading.
Spring
Thanks to spring, the environment is loaded only once. Spring does modify the files in bin/
. This is a time saver because loading Rails environment take lots of time.
Guard
I also added Guard gem to auto watch files and auto run the tests for file that changed.
So now instead of running test manually, I use guard
.
Because I'm on Windows with a VM, I use the -p
option to make sure Guard can detect changes made on Windows. It uses the 'polling' option.
I also specified explicitly the RAILS_ENV in spec_helper.rb
Sources: http://girders.org/blog/2014/02/06/setup-rails-41-spring-rspec-and-guard/ Related commit: e6140b9707194cc8bbc8af362f131e6846371e6c