Codeship不适用于Rails多宇宙宝石

时间:2019-07-17 04:21:14

标签: ruby-on-rails codeship

本地所有测试都通过了,但是我无法让rspec在Codeship上运行:

脚本:

bundle exec rake db:drop db:create db:migrate
DB=catalog bundle exec rake db:drop db:create db:migrate

DB=catalog bundle exec rails db:test:prepare
bundle exec rspec

代码错误:

Failure/Error: establish_connection :"catalog_#{Rails.env}"


ActiveRecord::AdapterNotSpecified:
  'catalog_test' database is not configured. Available: ["development", "test"]

ActiveRecord::ConnectionNotEstablished:
  No connection pool with 'CatalogRecord' found.

database.yml:

.
.
.
catalog_development:
  <<: *default
  database: catalog_development

catalog_test:
  <<: *default
  database: catalog_test

CatalogRecord

class CatalogRecord < ActiveRecord::Base
  self.abstract_class = true
  establish_connection :"catalog_#{Rails.env}"
end

1 个答案:

答案 0 :(得分:1)

在CodeShip Basic上滚动项目将have their database.yml file overwritten in order to connect to default databases。我会查看有关重新声明您自己的database.yml变体的链接文档。