· 1 min read
Screencast: Tests mit Spork beschleunigen
Downloads in verschiedenen Formaten:
Resourcen:
bash
[bash] rspec . time rspec . bundle spork —bootstrap spork rspec . —drb guard init spork [/bash]
Gemfile
[ruby] group :test do gem “spork”, ”> 0.9.0.rc” gem “guard-spork” end [/ruby]
Guardfile
[ruby] 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 [/ruby]
spec/spec_helper.rb
[ruby] 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 [/ruby]