Rails 3.1でrake db:test:prepareがundefined methodのエラー
sugino-yasuhiro-no-MacBook-Air:point_blog suginoyasuhiro$ rake db:test:prepare rake aborted! undefined method `prerequisites' for nil:NilClass (See full trace by running task with --trace)
StackOverflowにも挙っていたけど、対処方法がよくわからなかったので、bundle updateでRSpecのバージョンを2.5系から2.6系に上げたら直った。よくわからんので、ログを残しておく。
まずは直前にbundle installして、rspec:installをしたときの状態。
$ bundle install Using rake (0.9.2) Using multi_json (1.0.3) Using activesupport (3.1.0) Using bcrypt-ruby (3.0.1) Using builder (3.0.0) Using i18n (0.6.0) Using activemodel (3.1.0) Using erubis (2.7.0) Using rack (1.3.2) Using rack-cache (1.0.3) Using rack-mount (0.8.3) Using rack-test (0.6.1) Using hike (1.2.1) Using tilt (1.3.3) Using sprockets (2.0.0) Using actionpack (3.1.0) Using mime-types (1.16) Using polyglot (0.3.2) Using treetop (1.4.10) Using mail (2.3.0) Using actionmailer (3.1.0) Using arel (2.2.1) Using tzinfo (0.3.29) Using activerecord (3.1.0) Using activeresource (3.1.0) Using ansi (1.3.0) Using bundler (1.0.10) Using coffee-script-source (1.1.2) Using execjs (1.2.6) Using coffee-script (2.2.0) Using orm_adapter (0.0.5) Using warden (1.0.5) Using devise (1.4.5) Using diff-lcs (1.1.2) Using rack-ssl (1.3.2) Using rdoc (3.9.4) Using thor (0.14.6) Using railties (3.1.0) Using jquery-rails (1.0.14) Using rails (3.1.0) Using rspec-core (2.5.1) Using rspec-expectations (2.5.0) Using rspec-mocks (2.5.0) Using rspec (2.5.0) Using rspec-rails (2.5.0) Using sass (3.1.7) Using sqlite3 (1.3.4) Using turn (0.8.2) Using uglifier (1.0.3) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. $ rails g rspec:install create .rspec create spec create spec/spec_helper.rb
RSpecのバージョンを2.5系から2.6系に上げた。他にもいくつかバージョンが上がっている。rake db:test:prepareが通った。
$ sudo bundle update Password: Fetching source index for http://rubygems.org/ Using rake (0.9.2) Using multi_json (1.0.3) Using activesupport (3.1.0) Using bcrypt-ruby (3.0.1) Using builder (3.0.0) Using i18n (0.6.0) Using activemodel (3.1.0) Using erubis (2.7.0) Installing rack (1.3.3) Using rack-cache (1.0.3) Using rack-mount (0.8.3) Using rack-test (0.6.1) Using hike (1.2.1) Using tilt (1.3.3) Using sprockets (2.0.0) Using actionpack (3.1.0) Using mime-types (1.16) Using polyglot (0.3.2) Using treetop (1.4.10) Using mail (2.3.0) Using actionmailer (3.1.0) Using arel (2.2.1) Using tzinfo (0.3.29) Using activerecord (3.1.0) Using activeresource (3.1.0) Using ansi (1.3.0) Using bundler (1.0.10) Using coffee-script-source (1.1.2) Installing execjs (1.2.8) Using coffee-script (2.2.0) Using orm_adapter (0.0.5) Using warden (1.0.5) Installing devise (1.4.7) Installing diff-lcs (1.1.3) Using rack-ssl (1.3.2) Using rdoc (3.9.4) Using thor (0.14.6) Using railties (3.1.0) Using jquery-rails (1.0.14) Using rails (3.1.0) Installing rspec-core (2.6.4) Installing rspec-expectations (2.6.0) Installing rspec-mocks (2.6.0) Installing rspec (2.6.0) Installing rspec-rails (2.6.1) Using sass (3.1.7) Using sqlite3 (1.3.4) Using turn (0.8.2) Using uglifier (1.0.3) Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed. $ rake db:test:prepare $