Created
November 12, 2015 16:58
-
-
Save duffyjp/af04132f7eb431626331 to your computer and use it in GitHub Desktop.
Parallel Tests & Rspec shell script - Intelligently runs single spec with rspec or folder(s) / full suite with parallel_rspec. Shows nice summary at the end.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
start_time=`date +%s` | |
RAILS_ENV="test" | |
rm db/test.sqlite3* | |
if [[ $1 == *".rb"* ]] | |
then | |
echo "Testing with RSpec" | |
bundle exec rspec $1 | |
else | |
echo "Testing with Parallel Tests" | |
bundle exec rake parallel:create # Create 0 byte sqlite file for each cpu core | |
bundle exec rake parallel:load_schema # Load schema ignoring development | |
if [[ $1 == "" ]] | |
then | |
parallel_rspec ./spec ./vendor/engines/compensation/spec | |
else | |
parallel_rspec $1 | |
fi | |
fi | |
end_time=`date +%s` | |
time_elapsed=$(($end_time-$start_time)) | |
echo "===============================================================================" | |
grep "rspec \./" tmp/failing_specs.log | sort -n | |
echo "Testing took $time_elapsed seconds" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment