]> iEval git - gruntmaster-data.git/commitdiff
Do not crash in t/tools.t if postgres is not running
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 10 Oct 2015 13:32:29 +0000 (14:32 +0100)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 10 Oct 2015 13:32:29 +0000 (14:32 +0100)
lib/Gruntmaster/App.pm
t/tools.t

index c867f70b6738a88dfc0ad6c96213015d2ddcc35a..28c80e29d9527f4e2742dee7b4169ce5e4374830 100644 (file)
@@ -21,7 +21,10 @@ sub global_opt_spec {
 
 sub table { shift->global_options->{table} }
 
-dbinit $ENV{GRUNTMASTER_DSN} // 'dbi:Pg:';
+sub run {
+       dbinit $ENV{GRUNTMASTER_DSN} // 'dbi:Pg:';
+       shift->SUPER::run(@_);
+}
 
 1;
 __END__
index 59ed75523249d233288df11092ad5b0f6b9f6ab6..6a08457cf960816b2a3450fb08b6170e3fa8fbcb 100644 (file)
--- a/t/tools.t
+++ b/t/tools.t
@@ -10,6 +10,8 @@ BEGIN {
        eval {
                dbinit 'dbi:Pg:dbname=gmtest'; 1;
        } or plan skip_all => 'Cannot connect to test database. Create it by running make_test_db.sh before running this test. '. "Error: $@";
+       no warnings 'redefine';
+       *Gruntmaster::App::dbinit = sub {}; # Prevent reinit in Gruntmaster::App->run
        plan tests => 30;
 }
 
This page took 0.022317 seconds and 4 git commands to generate.