aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2014-05-21 11:42:23 +0000
committerMatthew Somerville <matthew@mysociety.org>2014-12-12 12:41:32 +0000
commit244b2876c837f65ed9477a57c3ed297f493b44a5 (patch)
tree0f8c3eb297e59fe98ffc79b74137c5fd5e8f4784 /bin
parent43c98742ee85c73c4783451ceeea28108bb793c6 (diff)
Add a script to always test on a clean db/config.
Fixes #786.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/test-wrapper35
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/test-wrapper b/bin/test-wrapper
new file mode 100755
index 000000000..9cb1791a1
--- /dev/null
+++ b/bin/test-wrapper
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+use strict; use warnings;
+
+BEGIN {
+ use FindBin;
+ require "$FindBin::Bin/../setenv.pl";
+}
+
+use FixMyStreet::TestAppProve;
+
+=head1 NAME
+
+bin/test-wrapper - spin up a clean database and configuration for tests
+
+=head1 USAGE
+
+ bin/test-wrapper t/ # runs prove -r t/ (recursively, saving state)
+ bin/test-wrapper --state=failed # runs just failing tests
+ # delete .prove to reset
+
+ bin/test-wrapper t/foo.t # runs with prove -v (single test)
+
+By default we use conf/general.yml-example as the template, and spin up a fresh
+Postgres cluster and database. We can override this by doing:
+
+ bin/test-wrapper --config=general.mycobrand.yml
+ bin/test-wrapper --db-config=general.yml # e.g. use your current DB settings
+ bin/test-wrapper --all-config=general.yml # e.g. use your current DB settings
+
+(NB: passing --state=save automagically is experimental, and will be removed if
+it turns out to be annoying.)
+
+=cut
+
+FixMyStreet::TestAppProve->run(@ARGV);