Quick Spork/RSpec Setup

  1. Make sure RSpec is already running.

  2. Add this in your Gemfile

# Gemfile
gem 'spork'
  1. In your project application root, create a .rspec file if its not already created and add –drb in the first line.
# .rspec
  1. Add Spork.prefork block into spec_helper.
# spec/spec_helper.rb
require 'spork'

Spork.prefork do
  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'
  1. Reload Spork

  2. Done!