make dispatch_misc.t handle Plack's MockHTTP's on error behaviour changing
Matt S Trout [Thu, 7 Aug 2014 14:37:37 +0000 (14:37 +0000)]
Changes
t/dispatch_misc.t

diff --git a/Changes b/Changes
index be269da..6d35e0b 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
 Revision history for Web-Simple
 
+  - make dispatch_misc.t handle Plack's MockHTTP's on error behaviour changing
+
 0.029 - 2014-07-27
   - fix repository metadata (Thomas Sibley)
 
index 842cf52..a4ab38a 100644 (file)
@@ -126,12 +126,22 @@ sub invalid_psgi_responses {
     for my $response ( @responses ) {
         @dispatch = ( sub (/) { $response->[0] } );
 
-        eval { run_request( GET => 'http://localhost/' ) };
-
-        like $@, qr/Can't call method "request" on an undefined value .*MockHTTP/,
-          sprintf(
+        my $message = sprintf(
             "if a route returns %s, then that is returned as a response by WD, causing HTTP::Message::PSGI to choke",
-            $response->[1] );
+            $response->[1]
+        );
+
+        # Somewhere between 1.0028 and 1.0031 Plack changed so that the
+        # FauxObject case became a 500 rather than a die; in case it later does
+        # the same thing for other stuff, just accept either sort of error
+
+        my $res = eval { run_request( GET => 'http://localhost/' ) };
+
+        if ($res) {
+          ok $res->is_error, $message;
+        } else {
+          like $@, qr/Can't call method "request" on an undefined value .*MockHTTP/, $message;
+        }
         undef $@;
     }
 }