Last Updated: February 25, 2016
·
2.087K
· job

Turbo Testing with Spring

You want to speed up your Rails tests by preloading your application, but you're always fighting with Spork or Zeus? Spring is easy and requires almost no setup!

You just need to install the spring gem

gem install spring

And then create a little binstub for your favourite test flavour

spring binstub rspec

spring binstub cucumber

spring binstub testunit

Now just run your tests by calling the just-created scripts

bin/rspec

bin/cucumber

bin/testunit

You'll see you test speed has increased quite a bit, without having to create fragile configurations for the specificities of your application.

The spring gem is still in Alpha and you should definately check it out here:
https://github.com/jonleighton/spring

2 Responses
Add your response

Great post, thanks! Does it work with guard for testing changed files?

over 1 year ago ·

I didn't try it, but I suppose it does. The change to your Guardfile should be minimal: replace any call to rspec or cucumber with bin/rspec and bin/cucumber.

over 1 year ago ·