From 75cb416b62c256eadc14f70f448110463b270e13 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Mon, 15 Sep 2014 23:58:55 -0700 Subject: [PATCH] added diagnostics for failed spool_dir test likely due to config caching --- t/qpsmtpd.t | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/t/qpsmtpd.t b/t/qpsmtpd.t index 568e9fd..f4183b4 100644 --- a/t/qpsmtpd.t +++ b/t/qpsmtpd.t @@ -2,6 +2,7 @@ use strict; use warnings; +use Cwd; use Data::Dumper; use File::Path; use Test::More; @@ -13,7 +14,6 @@ BEGIN { use_ok('Qpsmtpd'); use_ok('Qpsmtpd::Constants'); use_ok('Test::Qpsmtpd'); - } my $qp = bless {}, 'Qpsmtpd'; @@ -67,16 +67,17 @@ sub __load_logging { sub __spool_dir { my $dir = $qp->spool_dir(); - ok( $dir, "spool_dir is at $dir"); + ok($dir, "spool_dir is at $dir"); - my $cwd = `pwd`; - chomp($cwd); - open my $spooldir, '>', "./config.sample/spool_dir"; - print $spooldir "$cwd/t/tmp"; - close $spooldir; + my $cwd = getcwd; + chomp $cwd; + open my $SD, '>', "./config.sample/spool_dir"; + print $SD "$cwd/t/tmp"; + close $SD; my $spool_dir = $smtpd->spool_dir(); - ok($spool_dir =~ m!t/tmp/$!, "Located the spool directory"); + ok($spool_dir =~ m!/tmp/$!, "Located the spool directory") + or diag ("spool_dir: $spool_dir instead of tmp"); my $tempfile = $smtpd->temp_file(); my $tempdir = $smtpd->temp_dir();