1

The builds for my rails app are failing with the following error on running tests

9) FailedKeyChecks should contain a value
Failure/Error: ActiveRecord::Base.connection.execute(query)

ActiveRecord::NoDatabaseError:
  FATAL:  database "myapp_development" does not exist

10) User is invalid without name
Failure/Error: raise ActiveRecord::NoDatabaseError.new(error.message, error)

ActiveRecord::NoDatabaseError:
  FATAL:  database "myapp_development" does not exist

what am I doing wrong? My codeship.database.yml file

development:
  adapter: postgresql
  host: localhost
  encoding: unicode
  pool: 10
  username: <%= ENV['PG_USER'] %>
  template: template1
  password: <%= ENV['PGPASSWORD'] %>
  database: development<%= ENV['TEST_ENV_NUMBER'] %>
  port: <%= ENV['DATABASE_PORT'] %>
  sslmode: disable
test:
  adapter: postgresql
  host: localhost
  encoding: unicode
  pool: 10
  username: <%= ENV['PG_USER'] %>
  template: template1
  password: <%= ENV['PGPASSWORD'] %>
  database: test<%= ENV['TEST_ENV_NUMBER'] %>
  port: <%= ENV['DATABASE_PORT'] %>
  sslmode: disable

my setup commands

rvm use 2.4.1 --install
bundle install
cp codeship.database.yml config/database.yml
export RAILS_ENV=test
bundle exec rake db:create
#bundle exec rake db:migrate
bundle exec rake db:schema:load

and my test commands

RAILS_ENV=test bundle exec rake
RAILS_ENV=test bundle exec rspec

any idea why development database is being referenced? Thanks in advance

Tony Vincent
  • 13,354
  • 7
  • 49
  • 68

1 Answers1

0

Try running bundle exec rake db:create:all followed by bundle exec rake db:migrate It might have failed because you forgot the 'all'

Russell Kranz
  • 119
  • 1
  • 6