#285 Spork
Spork improves the loading time of your test suite by starting up your Rails application once in the background. Use it with Guard for the ultimate combo in fast feedback while doing TDD.
- Download:
- source codeProject Files in Zip (94.6 KB)
- mp4Full Size H.264 Video (22.2 MB)
- m4vSmaller H.264 Video (11.5 MB)
- webmFull Size VP8 Video (13.7 MB)
- ogvFull Size Theora Video (27.8 MB)
Resources
bash
rspec .
time rspec .
bundle
spork --bootstrap
spork
rspec . --drb
guard init spork
rspec . time rspec . bundle spork --bootstrap spork rspec . --drb guard init spork
Gemfile
group :test do
gem "spork", "> 0.9.0.rc"
gem "guard-spork"
end
group :test do gem "spork", "> 0.9.0.rc" gem "guard-spork" end
Guardfile
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('spec/spec_helper.rb')
watch(%r{^spec/support/.+\.rb$})
end
guard 'rspec', :version => 2, :cli => "--drb", :all_on_start => false, :all_after_pass => false do
# ...
end
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do watch('config/application.rb') watch('config/environment.rb') watch(%r{^config/environments/.+\.rb$}) watch(%r{^config/initializers/.+\.rb$}) watch('spec/spec_helper.rb') watch(%r{^spec/support/.+\.rb$}) end guard 'rspec', :version => 2, :cli => "--drb", :all_on_start => false, :all_after_pass => false do # ... end
spec/spec_helper.rb
require 'rubygems'
require 'spork'
Spork.prefork do
# ...
RSpec.configure do |config|
# ...
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end
end
Spork.each_run do
# This code will be run each time you run your specs.
FactoryGirl.reload
end
require 'rubygems' require 'spork' Spork.prefork do # ... RSpec.configure do |config| # ... config.treat_symbols_as_metadata_keys_with_true_values = true config.filter_run :focus => true config.run_all_when_everything_filtered = true end end Spork.each_run do # This code will be run each time you run your specs. FactoryGirl.reload end

