Skip to content

Commit

Permalink
fix to allow travis tests for different RAILS_ENV
Browse files Browse the repository at this point in the history
updated test database config to support development and production
environments
  • Loading branch information
stuzart committed Oct 15, 2019
1 parent 3fac8df commit 609ab35
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ before_install:

before_script:
- sh -c "if [ '$SUITE' = 'rake teaspoon' ]; then sh -e /etc/init.d/xvfb start && sleep 60; fi"
- sh -c "if [ '$DB_TYPE' = 'pgsql' ]; then psql -c 'create database travis_ci_test;' -U postgres; fi"
- sh -c "if [ '$DB_TYPE' = 'pgsql' ]; then psql -c 'create database travis_ci_test; create database travis_ci_dev; create database travis_ci_prod;' -U postgres; fi"
- cp test/database.travis.$DB_TYPE.yml config/database.yml
- RAILS_ENV=test bundle exec rake db:create
- RAILS_ENV=test bundle exec rake db:schema:load
Expand Down
5 changes: 5 additions & 0 deletions test/database.travis.mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ test:
database: seek_test
username: root

development:
adapter: mysql2
database: seek_dev
username: root

production:
adapter: mysql2
database: seek_prod
Expand Down
10 changes: 10 additions & 0 deletions test/database.travis.postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@ test:
adapter: postgresql
database: travis_ci_test
username: postgres

development:
adapter: postgresql
database: travis_ci_dev
username: postgres

production:
adapter: postgresql
database: travis_ci_prod
username: postgres
10 changes: 10 additions & 0 deletions test/database.travis.sqlite3.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
test:
adapter: sqlite3
database: db/test.sqlite3
timeout: 5000

development:
adapter: sqlite3
database: db/dev.sqlite3
timeout: 5000

production:
adapter: sqlite3
database: db/prod.sqlite3
timeout: 5000

0 comments on commit 609ab35

Please sign in to comment.