我的rails应用程序的构建在运行测试时失败,并出现以下错误
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我做错了什么?我的codeship.database.yml文件
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我的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还有我的test commands
RAILS_ENV=test bundle exec rake
RAILS_ENV=test bundle exec rspec你知道为什么要引用开发数据库吗?提前感谢
发布于 2017-04-19 18:14:38
尝试运行bundle exec rake db:create:all,然后运行bundle exec rake db:migrate,它可能会失败,因为您忘记了'all‘
https://stackoverflow.com/questions/43491788
复制相似问题