Search⌘ K
AI Features

Using Spring

Explore how to use Spring in your Rails applications to speed up test execution by running background processes that keep your environment ready. Learn to manage Spring's commands, integrate it with Bundler and RSpec binstubs, and understand when to restart or stop Spring for smooth testing performance.

Using Spring

Spring defines a half dozen or so subcommands that can all be called with syntax like bundle exec spring <command>. Let’s try running <command> in the terminal below:

Terminal 1
Terminal
Loading...

After we run the tests, we can check the status of Spring again:

Ruby
$ bundle exec spring status

After we run my tests, Spring stays running in the background, as confirmed by the spring status update. If we then enter the Rails console or Rails server, Spring will start up another instance in the development environment and hold onto both of them in the background.

Running the test again

If we then run our tests again with another spring rspec, the tests will start noticeably faster, but sadly, not in a way we can show ourselves by running another set of commands. Since the part that is ...