mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
36 lines
665 B
Bash
Executable file
36 lines
665 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
docker_compose="docker-compose --file test-envs/docker-compose-$1-$2.yml"
|
|
|
|
function cleanup() {
|
|
$docker_compose down
|
|
}
|
|
|
|
function die() {
|
|
echo $@
|
|
exit 1
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
export RAILS_ENV=test
|
|
export DATABASE_NAME=tracks_test
|
|
|
|
$docker_compose build
|
|
$docker_compose up -d
|
|
script/poll-for-db
|
|
|
|
# Leaving this in since it will be needed for Rails 5
|
|
$docker_compose run web bin/rails db:environment:set RAILS_ENV=test || true
|
|
|
|
if [ "$2" == "mysql" ];
|
|
then
|
|
$docker_compose run web bin/rake db:reset
|
|
else
|
|
$docker_compose run web bin/rake db:migrate
|
|
$docker_compose run web bin/rake db:seed
|
|
fi
|
|
$docker_compose run web bin/rake test
|
|
|