Rails3.1.0でspork
rspecが遅いので、Rails3.1.0でsporkを使おうと思いましたが
エラーとなりました。
$ spork –bootstrap NOTE: Gem.latest_load_paths is deprecated with no replacement. It will be removed on or after 2011-10-01. Gem.latest_load_paths called from /Users/rochefort/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.8.5/lib/spork.rb:112. NOTE: Gem.all_partials is deprecated with no replacement. It will be removed on or after 2011-10-01. Gem.all_partials called from /Users/rochefort/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:598. NOTE: Gem.all_partials is deprecated with no replacement. It will be removed on or after 2011-10-01. Gem.all_partials called from /Users/rochefort/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:598. uninitialized constant Spork::Runner::StringIO (NameError) /Users/rochefort/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.8.5/lib/spork/runner.rb:38:in `supported_test_frameworks_text' /Users/rochefort/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.8.5/lib/spork/runner.rb:52:in `rescue in find_test_framework' /Users/rochefort/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.8.5/lib/spork/runner.rb:48:in `find_test_framework' /Users/rochefort/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.8.5/lib/spork/runner.rb:56:in `run' /Users/rochefort/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.8.5/lib/spork/runner.rb:9:in `run' /Users/rochefort/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.8.5/bin/spork:10:in `<top (required)>' /Users/rochefort/.rvm/gems/ruby-1.9.2-p290/bin/spork:19:in `load' /Users/rochefort/.rvm/gems/ruby-1.9.2-p290/bin/spork:19:in `<main>'
調べてみると
spork fails to work with rubygems 1.8.0/1.8.1 but works with 1.7.2 / Problems / Discussion Area - RubyGems Support
0.9.0rc7で対応してくれているそうです。
(追記:readme にも書いてました。)
Gemfileを書換えて
gem 'spork', '~> 0.9.0.rc'
bundle installするとうまくいきました。
あとは
1. spork --bootstrap
2. spec_helper修正
1でspec_helperが書き変わるので
今までの内容を、Spork.preforkブロックの中に移行。
3. spork起動
4. rspecをdrbで実行
rspec --drb
とても快適。次はguard。