DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Alexey has posted 28 posts at DZone. View Full User Profile

Spork Gem To Improve RSpec Launch Time

  • submit to reddit
        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: