multiverse gem with Codeship
Closed this issue · 3 comments
locally all tests are passing but I cannot get rspec to run on 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
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:
development:
<<: *default
database: main_development
test:
<<: *default
database: main_test
.
.
.
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
Hey @saslani, the error indicates an issue with your database.yml
(it only has config for two database environments - development
and test
). I haven't used Codeship before, but from the docs, it looks like it may replace database.yml
. In that case, you can follow the instructions here for adding a codeship.database.yml
and copying it over in setup commands. https://documentation.codeship.com/basic/databases/postgresql/
The main cp database.yml has all the info. But the problem seem to be rake:db:prepare
I also tried your suggestion, still not working.
If I just leave DB=catalog bundle exec rake db:drop db:create db:migrate
everything is ok. But it breaks when I run the tests:
DB=catalog bundle exec rails db:test:prepare
bundle exec rspec
This error indicates it's a problem with database.yml
:
'catalog_test' database is not configured. Available: ["development", "test"]
Stack Overflow would be a better place to get help.