Based on the doc you must first enable the postgresql service
services: - postgresql
And specify DB type with (optional):
env: - DB=pgsql
NOTE: postgresql and postgres DO NOT WORK. Use pgsql !!!
Here is the complete code that worked for me:
.travis.yml
language: ruby rvm: - 2.2 env: - DB=pgsql services: - postgresql script: - RAILS_ENV=test bundle exec rake db:migrate --trace - bundle exec rake db:test:prepare - bundle exec rake before_script: - cp config/database.yml.travis config/database.yml - psql -c 'create database courseselect_test;' -U postgres
configurations / database.yml.travis
default: &default adapter: postgresql encoding: unicode pool: 5 development: <<: *default database: courseselect_development test: <<: *default database: courseselect_test production: <<: *default database: courseselect_developement
By the way, I also have a database.yml file with the same contents as config/database.yml.travis
source share