reevoo/sapience-rb

View on GitHub
bin/tests

Summary

Maintainability
Test Coverage
#!/usr/bin/env bash

current_dir="$(pwd)"
function finish {
  cd $current_dir
}
trap finish EXIT

bundle update
bundle exec rake reevoocop spec
[ $? -ne 0 ] && exit $?

pushd test_apps/grape
bundle update
[ $? -ne 0 ] && exit $?
bundle exec appraisal update
[ $? -ne 0 ] && exit $?
APP_NAME=grape_app bundle exec appraisal rspec
[ $? -ne 0 ] && exit $?
popd

pushd test_apps/sinatra
bundle update
[ $? -ne 0 ] && exit $?
bundle exec appraisal update
[ $? -ne 0 ] && exit $?
APP_NAME=sinatra_app bundle exec appraisal rspec
[ $? -ne 0 ] && exit $?
popd


projects=(rails_3_2 rails_4_2 rails_5_0)
for project in ${projects[@]}
do
  directory="test_apps/$project"
  if [ -d $directory ]; then
    pushd $directory
    bundle update
    [ $? -ne 0 ] && exit $?
    APP_NAME=$project bundle exec rake db:create db:migrate db:test:prepare
    [ $? -ne 0 ] && exit $?
    APP_NAME=$project bundle exec rspec
    [ $? -ne 0 ] && exit $?
    popd
  fi;
done;

bundle exec rake coverage:merge
[ $? -ne 0 ] && exit $?