Last active
September 10, 2015 01:02
-
-
Save davidoram/4888723e6ec452769a9c to your computer and use it in GitHub Desktop.
Given a list of specs, run one test together with each in the list
This file contains 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 | |
# | |
# Run a failing spec in combination with each other spec and record which combinations cause a failure | |
# | |
# Put a list of all specs into specs.txt | |
# eg: $ $ find spec -name '*_spec.rb' -print > specs.txt | |
# Set the failingspec variable below | |
# Set the seed variable below | |
# | |
# Writes a log to testspec.log, which is formatted as follows: | |
# ... | |
# OK: ./spec/controllers/my_controller_spec.rb and ./spec/controllers/my_failing_spec.rb | |
# OK: ./spec/controllers/other_controller_spec.rb and ./spec/controllers/my_failing_spec.rb | |
# FAILED: ./spec/controllers/bad_controller_spec.rb and ./spec/controllers/my_failing_spec.rb | |
# ... | |
# | |
# | |
outfile=testspec.log | |
failingspec=./spec/controllers/burney/payments_controller_spec.rb | |
seed=34104 | |
echo "Test run started" > $outfile | |
for spec in `cat specs.txt` | |
do | |
echo "Running $spec and $failingspec ..." | |
bundle exec rspec $spec $failingspec --seed $seed | |
rc=$? | |
if [[ $rc == 0 ]] | |
then | |
echo "OK: $spec and $failingspec" >> $outfile | |
else | |
echo "FAILED: $spec and $failingspec" >> $outfile | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment