Spork Gem To Improve RSpec Launch Time
Join the DZone community and get the full member experience.Join For Free
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 --prereleaseOr add following to Rails Gemfile:
gem 'spork', '>= 0.9.0.rc'and run
sudo bundleRun in your Rails project root.
spork --bootstrapThis will add some code and instructions to spec/spec_helper.rb. Follow the instructions and distribute configuration between sections. Start spork server:
spork rspecIn another terminal launch specs (first green dot should appear 10 times faster the usual):
rspec --drb spec/controllers/your_controller_spec.rbRead here how to autorestart spork with guard: http://blog.carbonfive.com/2010/12/10/speedy-test-iterations-for-rails-3-with-spork-and-guard/