Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix tests to pass on 5.14.0, mac OS X

  • Loading branch information...
commit 72d3776d709f3bdbc26e72c0f80a1ba01a968210 1 parent d5ba676
Alberto Simões authored August 24, 2011

Showing 1 changed file with 12 additions and 5 deletions. Show diff stats Hide diff stats

  1. 17  t/dispatcher.t
17  t/dispatcher.t
@@ -70,7 +70,7 @@ my @tests = (
70 70
             REQUEST_METHOD => 'GET',
71 71
             PATH_INFO      => '/error',
72 72
         },
73  
-        expected => [500, [], [qq{Internal Server Error\n\nCan't locate object method "fail" via package "Fail" (perhaps you forgot to load "Fail"?) at t/dispatcher.t line 26.\n\n}]]
  73
+        expected => [500, [], qr{^Internal Server Error\n\nCan't locate object method "fail" via package "Fail" \(perhaps you forgot to load "Fail"\?\) at t/dispatcher\.t line 26.*$}s]
74 74
     },
75 75
     {   env => {
76 76
             REQUEST_METHOD => 'GET',
@@ -92,7 +92,7 @@ my @tests = (
92 92
 
93 93
 # simulates a redirect with halt
94 94
 $app->add_hook(Dancer::Core::Hook->new(
95  
-    name => 'before', 
  95
+    name => 'before',
96 96
     code => sub {
97 97
         my $ctx = shift;
98 98
         if ($ctx->request->path_info eq '/haltme') {
@@ -105,7 +105,7 @@ $app->add_hook(Dancer::Core::Hook->new(
105 105
 
106 106
 my $was_in_second_filter = 0;
107 107
 $app->add_hook(Dancer::Core::Hook->new(
108  
-    name => 'before', 
  108
+    name => 'before',
109 109
     code => sub {
110 110
         my $ctx = shift;
111 111
         if ($ctx->request->path_info eq '/haltme') {
@@ -121,7 +121,7 @@ $app->add_route(
121 121
 );
122 122
 $app->compile_hooks;
123 123
 
124  
-plan tests => scalar(@tests) + 1;
  124
+plan tests => scalar(@tests) * 3 + 1;
125 125
 
126 126
 my $dispatcher = Dancer::Core::Dispatcher->new(apps => [$app]);
127 127
 foreach my $test (@tests) {
@@ -129,7 +129,14 @@ foreach my $test (@tests) {
129 129
     my $expected = $test->{expected};
130 130
 
131 131
     my $resp = $dispatcher->dispatch($env);
132  
-    is_deeply $resp, $expected;
  132
+
  133
+    is $resp->[0] => $expected->[0], "Return code ok.";
  134
+    is_deeply $resp->[1] => $expected->[1], "Headers ok.";
  135
+    if (ref($expected->[2]) eq "Regexp") {
  136
+        like $resp->[2][0] => $expected->[2], "Contents ok.";
  137
+    } else {
  138
+        is_deeply $resp->[2] => $expected->[2], "Contents ok.";
  139
+    }
133 140
 }
134 141
 
135 142
 is $was_in_second_filter, 0, "didnt enter the second filter, because of halt";

0 notes on commit 72d3776

Please sign in to comment.
Something went wrong with that request. Please try again.