由于某种原因,rspec-rails 2.1.6停止在Ruby 2中工作

时间:2015-02-19 16:12:58

标签: rspec ruby-2.1.5

我的规格在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会不同?我该怎么调试呢?

0 个答案:

没有答案