Ruby on rails 代码传递生成失败,出现NodeDatabaseError
my rails应用程序的构建失败,运行测试时出现以下错误Ruby on rails 代码传递生成失败,出现NodeDatabaseError,ruby-on-rails,codeship,Ruby On Rails,Codeship,my 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 nam
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
和我的测试命令
RAILS_ENV=test bundle exec rake
RAILS_ENV=test bundle exec rspec
知道为什么要引用开发数据库吗?提前感谢尝试运行
bundle exec rake db:create:all
然后是bundle exec rake db:migrate
它可能失败了,因为您忘记了“全部”请尝试运行
bundle exec rake db:create:all
然后是bundle exec rake db:migrate
它可能失败了,因为您忘记了“全部”谢谢您的快速响应,但是,它不会改变任何事情。对于快速响应,它不会改变任何事情
RAILS_ENV=test bundle exec rake
RAILS_ENV=test bundle exec rspec