2017-04-19 75 views
0

的建立爲我的Rails應用程序,下面的錯誤是失敗上運行測試Codeship建立與NoDatabaseError失敗

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 

爲什麼開發數據庫被引用的任何想法?在此先感謝

回答

0

嘗試運行bundle exec rake db:create:all 其次bundle exec rake db:migrate 它可能失敗,因爲你忘了「全部」

+0

感謝您的快速響應,但是,它不會改變任何東西 –