我将Rails堆栈从4.2.x升级到5.0.1。此堆栈没有数据库支持的模型。使用rspec作为测试框架。测试在4.2.x环境中运行,但不在5.0.1分支中运行。
尽管如上所述,rspec仍试图加载灯具并最终引发异常(下面的堆栈跟踪),因为ActiveRecord没有连接池。有什么建议要检查以纠正这个问题吗?
的Gemfile:
gem 'rack-cors'
gem 'oauth2'
gem 'activemodel-serializers-xml'
gem 'draper', '~> 3.0.0.pre1'
gem 'aws-sdk', '~> 1.61.0'
gem 'newrelic_rpm'
gem 'skylight', '= 1.0.0'
gem 'actionpack-page_caching', '~> 1.1.0'
gem 'redis'
gem 'sneakers'
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'meta_request'
gem 'brakeman'
gem 'redis-rails-instrumentation'
end
group :development, :test do
gem 'dotenv-rails'
gem 'rspec-rails'
gem 'listen'
end
group :test do
gem 'selenium-webdriver'
gem 'capybara'
gem 'faker'
gem 'launchy'
gem 'codeclimate-test-reporter', require: nil
gem 'mock_redis'
gem 'simplecov'
end
回溯:
ActiveRecord::ConnectionNotEstablished:
No connection pool with id primary found.
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `retrieve_connection'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/connection_handling.rb:128:in `retrieve_connection'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/connection_handling.rb:91:in `connection'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/fixtures.rb:516:in `create_fixtures'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/fixtures.rb:1015:in `load_fixtures'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/fixtures.rb:988:in `setup_fixtures'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.1/lib/active_record/fixtures.rb:852:in `before_setup'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-rails-3.5.2/lib/rspec/rails/adapters.rb:126:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:443:in `instance_exec'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:443:in `instance_exec'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:375:in `execute_with'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:606:in `block (2 levels) in run_around_example_hooks_for'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:338:in `call'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:338:in `call'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:607:in `run_around_example_hooks_for'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/hooks.rb:464:in `run'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:453:in `with_around_example_hooks'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:496:in `with_around_and_singleton_context_hooks'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example.rb:251:in `run'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:627:in `block in run_examples'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:623:in `map'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:623:in `run_examples'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:589:in `run'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:590:in `block in run'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:590:in `map'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/example_group.rb:590:in `run'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:113:in `block (3 levels) in run_specs'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:113:in `map'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:113:in `block (2 levels) in run_specs'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1835:in `with_suite_hooks'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:112:in `block in run_specs'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/reporter.rb:77:in `report'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:111:in `run_specs'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:87:in `run'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rspec-core-3.5.4/exe/rspec:4:in `<top (required)>'
# /Users/arvanasse/.rbenv/versions/2.2.3/bin/rspec:23:in `load'
# /Users/arvanasse/.rbenv/versions/2.2.3/bin/rspec:23:in `<top (required)>'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:74:in `load'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:27:in `run'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli.rb:335:in `exec'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli.rb:20:in `dispatch'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli.rb:11:in `start'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/exe/bundle:32:in `block in <top (required)>'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
# /Users/arvanasse/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/exe/bundle:24:in `<top (required)>'
# /Users/arvanasse/.rbenv/versions/2.2.3/bin/bundle:23:in `load'
# /Users/arvanasse/.rbenv/versions/2.2.3/bin/bundle:23:in `<main>'
答案 0 :(得分:0)
供将来参考: 我添加了'activemodel-serializers-xml'来恢复在Rails 5.01中提取但是最新生产版本的draper所需的一些功能。那个gem依赖于ActiveRecord(嗯,也许它应该是ActiveModel顾名思义?!)。更新到draper 3.0.0.pre1允许我删除'activemodel-serializers-xml',并且规格都是绿色的。 :)