Add a test showing how having an Engine::PSGI .psgi file breaks.
Tomas Doran [Sun, 27 Mar 2011 11:19:31 +0000 (12:19 +0100)]
Notably, this .psgi file is in the app root, whereas ::Engine::PSGI's docs and helper suggest that
you create it in script/. So I don't have a problem with not supporting the .psgi working for tests
until you've converted it if you move it into the app root really - however it would be nice to be
able to detect it was broken, rather than just hanging.

t/psgi_file_testapp_engine_psgi_compat.t [new file with mode: 0644]

diff --git a/t/psgi_file_testapp_engine_psgi_compat.t b/t/psgi_file_testapp_engine_psgi_compat.t
new file mode 100644 (file)
index 0000000..af16bc4
--- /dev/null
@@ -0,0 +1,34 @@
+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;
+        TestApp->setup_engine('PSGI');
+        my $app = sub { TestApp->run(@_) };
+    };
+    close($psgi);
+}
+use Catalyst::Test qw/ TestApp /;
+
+ok $main::have_loaded_psgi;
+ok request('/');
+
+done_testing;
+