Skip to content

Instantly share code, notes, and snippets.

@peternixey
Created January 20, 2012 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peternixey/1647211 to your computer and use it in GitHub Desktop.
Save peternixey/1647211 to your computer and use it in GitHub Desktop.
Some changes I made to the vanilla Rails / Spork / RSpec setup to ensure models get reloaded
# make sure your rspec block has the cli => drb line:
guard 'rspec', :cli => "--drb", :version => 2 do
YourApp::Application.configure do
...
config.cache_classes = false
end
gem "spork"
gem 'guard-spork'
gem 'guard'
gem 'guard-rspec'
# required for notifications via growl
gem 'ruby_gntp'
guard 'rspec', :cli => "--drb", :version => 2 do
# change this:
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' },
:rspec_env => { 'RAILS_ENV' => 'test' } do
# to this:
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' },
:rspec_env => { 'RAILS_ENV' => 'test' },
:cli => "--drb" do
# ...
end
# -------- How your guardfile will look initially
guard 'rspec', :version => 2 do
...
end
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' },
:rspec_env => { 'RAILS_ENV' => 'test' } do
...
end
# ---- How your guardfile SHOULD look
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' },
:rspec_env => { 'RAILS_ENV' => 'test' } do
...
end
guard 'rspec', :version => 2 do
...
end
# spec helper file
...
Spork.prefork do
...
# add this line to the prefork block - helps avoid crashes (as well as reloading routes)
Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
end
YourApp::Application.configure do
...
config.cache_classes = false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment