尝试使用Rails 4.1运行我的rspec 2.99测试时,为什么会出现“ActiveRecord :: ConnectionNotEstablished”错误?

时间:2014-08-18 15:33:47

标签: ruby-on-rails ruby ruby-on-rails-4 rspec-rails

我有一个Rails应用程序,我正在升级到Rails 4.1.4。我还有一个RSpec测试套件,我想用更新的Rails版本对应用程序运行。应用程序使用数据库,只是与服务进行通信。但是,当我尝试运行测试时,我收到此错误:

Failure/Error: Unable to find matching line from backtrace
 ActiveRecord::ConnectionNotEstablished:
   ActiveRecord::ConnectionNotEstablished
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/connection_handling.rb:87:in `connection'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/fixtures.rb:499:in `create_fixtures'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/fixtures.rb:984:in `load_fixtures'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/fixtures.rb:957:in `setup_fixtures'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/fixtures.rb:806:in `before_setup'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-rails-2.99.0/lib/rspec/rails/adapters.rb:68:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_exec'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_eval_with_args'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example.rb:241:in `instance_eval_with_args'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/hooks.rb:106:in `block (2 levels) in run'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/hooks.rb:104:in `call'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/hooks.rb:104:in `run'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/hooks.rb:446:in `run_hook'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example_group.rb:462:in `run_around_each_hooks'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example.rb:250:in `with_around_each_hooks'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example.rb:113:in `run'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example_group.rb:514:in `block in run_examples'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example_group.rb:510:in `map'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example_group.rb:510:in `run_examples'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example_group.rb:495:in `run'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/command_line.rb:24:in `block (2 levels) in run'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/command_line.rb:24:in `map'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/command_line.rb:24:in `block in run'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/reporter.rb:58:in `report'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/command_line.rb:21:in `run'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/runner.rb:103:in `run'
 # /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/runner.rb:17:in `block in autorun'

我不明白为什么它会尝试启动活动记录

当我不通过测试运行它时,应用程序运行正常,并且测试在Rails 4.0上运行得很好。我还在使用RSpec-rails 2.99。有谁知道问题可能是什么?

0 个答案:

没有答案