Faster Specs using Spring

June 28, 2022   • rails testing

If you’re working on a giant rails app that takes a long time to boot whenever you run the tests, I highly recommend giving spring-commands-rspec gem a try.

Spring is a Rails application preloader. It keeps the application running in the background, so you don’t need to load it every time you run a test, rake task, or even a migration.

Our application used to take almost a minute to load the files before running the tests. With Spring, it takes less than 5 seconds to run. Faster tests are great for developer productivity. Earlier, I used to wait for changes to accumulate before running a test. Now I can run the tests frequently after making small changes.

90% speed boost? I’ll take it.