ruby-on-railscodeship

Codeship doesn't work with Rails multiverse gem


locally all tests are passing but I cannot get rspec to run on Codeship:

Script:

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

Codeship error:

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

Solution

  • Rails projects on CodeShip Basic will have their database.yml file overwritten in order to connect to default databases. I would check out the linked documentation on re-asserting your own database.yml variant.