Spoiler: It was an outdated version of the rspec-rails
gem!
I encountered this error with any rake command issued from my rails project directory after moving my sqlite3 gem into a development block and then running 'rake db:migrate' to make sure everything still worked. Rake works fine elsewhere on my system. But any rake task I run in that directory gives me the following output with the trace:
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec/rails/tasks/rspec.rake:3:in `'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:8:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:8:in `block in '
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `call'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `block in load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `each'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/engine.rb:396:in `block in load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `each'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `all'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/engine.rb:396:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application.rb:103:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/ianyoung/rails/third_app/Rakefile:7:in `'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `'
The first error I got was the question title:
rake aborted! undefined method `prerequisites' for nil:NilClass
I've also been getting this, but it hasn't been causing me problems. Perhaps it's relevant?:
DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from at /Users/ianyoung/rails/third_app/config/application.rb:13)
DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from at /Users/ianyoung/rails/third_app/config/application.rb:13)
Answer
Updating to the latest rspec-rails gem relieved me of this problem and of the deprecation warnings.
Installing the latest webrat gem solved the missing has_selector? method problem that I had for some reason thought was a greater evil than my outdated rspec-rails gem. And all is well.
Thank you for the helpful comments.
No comments:
Post a Comment