Test showing how having a .psgi file will ruin your day
Tomas Doran [Sun, 27 Mar 2011 11:17:47 +0000 (12:17 +0100)]
t/psgi_file_testapp.t [new file with mode: 0644]

diff --git a/t/psgi_file_testapp.t b/t/psgi_file_testapp.t
new file mode 100644 (file)
index 0000000..b13464f
--- /dev/null
@@ -0,0 +1,33 @@
+use strict;
+use warnings;
+no warnings 'once';
+use FindBin qw/$Bin/;
+use lib "$Bin/lib";
+
+use Test::More;
+
+use File::Spec;
+use File::Temp qw/ tempdir /;
+
+my $temp;
+BEGIN {
+    $temp = tempdir( CLEANUP => 1 );
+
+    $ENV{CATALYST_HOME} = $temp;
+    open(my $psgi, '>', File::Spec->catdir($temp, 'testapp.psgi')) or die;
+    print $psgi q{
+        use strict;
+        use TestApp;
+
+        $main::have_loaded_psgi = 1;
+        my $app = sub { TestApp->psgi_app(@_) };
+    };
+    close($psgi);
+}
+use Catalyst::Test qw/ TestApp /;
+
+ok $main::have_loaded_psgi;
+ok request('/');
+
+done_testing;
+