运行:ruby 1.9.3p0,使用Rails 3.2.1
尝试使用rspec但是当我尝试将其安装到我的应用程序中时,我收到以下错误:
/Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `generators' for #<Rails::Railtie::Configuration:0x00000101b2f1b8> (NoMethodError)
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:4:in `<class:Railtie>'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:3:in `<module:Rails>'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:2:in `<module:RSpec>'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:1:in `<top (required)>'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `block in require'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.22/lib/bundler.rb:122:in `require'
from /Users/Si/dropbox/sh_rails_projects/test_app/config/application.rb:13:in `<top (required)>'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:24:in `require'
from /Users/Si/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:24:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我对rails和ruby都很陌生,所以这对我来说几乎没有任何意义,任何人都可以解释。
由于
答案 0 :(得分:11)
看起来你的rspec-rails版本是2.0.0.beta ...
尝试升级到〜&gt; 2.8,或者如果这是你在Gemfile上指定的内容,请运行bundle exec rails g rspec:install
要更新您的宝石版本,您的Gemfile应该具有以下内容:
group :test, :development do
gem "rspec-rails", "~> 2.8"
end
添加完毕后,运行bundle update rspec-rails
然后再次尝试安装,一切都应该像黄金一样好!