我的规格在 ruby 1.9.2 中运行良好。但是升级到 Ruby 2.1.5 后,当我运行规范时,我收到以下错误:
$ rspec spec/models/user_spec.rb
/local/rvm/gems/ruby-2.1.5/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract/connection_pool.rb:9:in `<module:ActiveRecord>': uninitialized constant ActiveRecord::ConnectionNotEstablished (NameError)
from /local/rvm/gems/ruby-2.1.5/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract/connection_pool.rb:6:in `<top (required)>'
from /local/rvm/gems/ruby-2.1.5/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract/connection_specification.rb:85:in `<class:Base>'
from /local/rvm/gems/ruby-2.1.5/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract/connection_specification.rb:4:in `<module:ActiveRecord>'
from /local/rvm/gems/ruby-2.1.5/gems/activerecord-3.2.17/lib/active_record/connection_adapters/abstract/connection_specification.rb:3:in `<top (required)>'
from /local/rvm/gems/ruby-2.1.5/gems/activerecord-3.2.17/lib/active_record/base.rb:719:in `<top (required)>'
from /local/rvm/gems/ruby-2.1.5/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:4:in `require'
from /local/rvm/gems/ruby-2.1.5/gems/activerecord-sqlserver-adapter-3.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:4:in `<top (required)>'
from /local/rvm/gems/ruby-2.1.5/gems/activerecord-sqlserver-adapter-3.2.10/lib/activerecord-sqlserver-adapter.rb:1:in `require'
from /local/rvm/gems/ruby-2.1.5/gems/activerecord-sqlserver-adapter-3.2.10/lib/activerecord-sqlserver-adapter.rb:1:in `<top (required)>'
from /local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:76:in `require'
from /local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:72:in `each'
from /local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:72:in `block in require'
from /local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:61:in `each'
from /local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:61:in `require'
from /local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.6.5/lib/bundler.rb:132:in `require'
from /testapp/config/application.rb:7:in `<top (required)>'
from /testapp/config/environment.rb:2:in `require'
from /testapp/config/environment.rb:2:in `<top (required)>'
from /testapp/spec/spec_helper.rb:3:in `require'
from /testapp/spec/spec_helper.rb:3:in `<top (required)>'
from /testapp/spec/models/user_spec.rb:1:in `require'
from /testapp/spec/models/user_spec.rb:1:in `<top (required)>'
from /local/rvm/gems/ruby-2.1.5/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load'
from /local/rvm/gems/ruby-2.1.5/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files'
from /local/rvm/gems/ruby-2.1.5/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
from /local/rvm/gems/ruby-2.1.5/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
from /local/rvm/gems/ruby-2.1.5/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
from /local/rvm/gems/ruby-2.1.5/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
from /local/rvm/gems/ruby-2.1.5/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
from /local/rvm/gems/ruby-2.1.5/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `block in autorun'
我正在使用 rspec-rails 2.6.1 和 rails 3.2.17。我不确定为什么这会在 Ruby 1.9.2 而不是 Ruby 2 中工作...... Bundler 会有所不同吗?我应该如何调试这个?