Skip to content

@equivalent /run_rails_app_tests.sh
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
This is a bash script that runs bundler, drop test database, recreates it, run migrations and runs specs and tests
#!/bin/sh
WORK_DIR=/Users/tomi/rails_apps/myapp/;
RETURN_DIR=/Users/tomi/my_bash_scripts/; #optional
if [ -r $WORK_DIR ]; then
cd $WORK_DIR
echo "Changing directory to $WORK_DIR"
#ls -l;
# if [ -f ./.rvmrc ]; then
# . ./.rvmrc
# fi
rvm current
read -p "Is this RVM version ok ? Press any key to start continue..."
bundle install; #install gems
RAILS_ENV=test bundle exec rake db:drop;
RAILS_ENV=test bundle exec rake db:create;
RAILS_ENV=test bundle exec rake db:migrate;
bundle exec rspec spec;
RAILS_ENV=developmnet bundle exec rake db:migrate; #rake requires that development enviroment has database updated to run unit tests, comment this if you don't want this feature
bundle exec rake test;
if [ -r $RETURN_DIR ]; then
echo "Changing directory back to $RETURN_DIR"
cd $RETURN_DIR;
fi
else
echo "Work Directory doesn't exist"
fi
### bash alias for this script add it into your ~/.bash_profile or ~/.bash_profile ###
### you might need to do chmod 755 /Users/tomi/my_bash_scripts/run_rails_app_tests.sh ###
# alias run_app_tests='/Users/tomi/my_bash_scripts/run_rails_app_tests.sh'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.