From: Marius Gavrilescu Date: Sat, 10 Oct 2015 13:32:29 +0000 (+0100) Subject: Do not crash in t/tools.t if postgres is not running X-Git-Tag: 5999.000_015~1 X-Git-Url: http://git.ieval.ro/?p=gruntmaster-data.git;a=commitdiff_plain;h=13af733e3f3f26ce7cee8d1f2154f82c93f4c3c3 Do not crash in t/tools.t if postgres is not running --- diff --git a/lib/Gruntmaster/App.pm b/lib/Gruntmaster/App.pm index c867f70..28c80e2 100644 --- a/lib/Gruntmaster/App.pm +++ b/lib/Gruntmaster/App.pm @@ -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__ diff --git a/t/tools.t b/t/tools.t index 59ed755..6a08457 100644 --- 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; }