Skip to content

Instantly share code, notes, and snippets.

@quad
Created November 1, 2011 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quad/1329756 to your computer and use it in GitHub Desktop.
Save quad/1329756 to your computer and use it in GitHub Desktop.
YO DAWG I HERD U LIKE ORDER-DEPENDENT TESTS?
#!/bin/sh
#
# YO DAWG I HERD U LIKE ORDER-DEPENDENT TESTS?
#
# SO I PUT ORDER-DEPENDENT EXAMPLES N UR ORDER-DEPENDENT SPECS
# SO U CAN B NON-DETERMINISTIC WHILE UR NON-DETERMINISTIC
#
# http://memegenerator.net/instance/11059517
function die () {
echo "$0: $@" >&2 &&
exit 1
}
function purge () {
rm $@ || true
}
DEV_DB=db/development.sqlite3
TEST_DB=db/test.sqlite3
SPECS=$(find test -name '*_spec.rb')
purge $DEV_DB &&
purge tmp/last_db_rebuild.touch &&
bin/rake db:rebuild >&2 || die "Could not rebuild the development database"
for s in $SPECS; do
purge $TEST_DB &&
bin/rake db:test:prepare >&2 ||
die "Could not prepare the test database"
bin/spec $s >&2 || echo $s
done
@quad
Copy link
Author

quad commented Nov 1, 2011

First revision of the find-fucked-tests script finds– via brute force– specs that are order-dependent.

Next up, per-example runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment