Over a million developers have joined DZone.

Spork Gem To Improve RSpec Launch Time

This reduced launch time of rspec for my rails project in Ubuntu VirtualBox on Win7 host from 35 secs to 2 sec.

sudo gem install spork --prerelease

Or add following to Rails Gemfile:

gem 'spork', '>= 0.9.0.rc'

and run

sudo bundle

Run in your Rails project root.

spork --bootstrap

This will add some code and instructions to spec/spec_helper.rb. Follow the instructions and distribute configuration between sections.

Start spork server:

spork rspec

In another terminal launch specs (first green dot should appear 10 times faster the usual):

rspec --drb spec/controllers/your_controller_spec.rb

Read here how to autorestart spork with guard:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}