test fixup
Matt S Trout [Sun, 22 Apr 2012 17:50:57 +0000 (17:50 +0000)]
lib/Web/Simple/Application.pm
t/post.t
t/predicate_objects.t

index f6804dc..51fa78e 100644 (file)
@@ -98,11 +98,11 @@ sub _test_request_spec_to_http_request {
     $request->headers->push_header($header, $value);
   }
 
-  if (($method eq 'POST' or $method eq 'PUT') and @rest) {
+  if (($method eq 'POST' or $method eq 'PUT') and @params) {
     my $content = do {
       require URI;
       my $url = URI->new('http:');
-      $url->query_form(@rest);
+      $url->query_form(@params);
       $url->query;
     };
     $request->header('Content-Type' => 'application/x-www-form-urlencoded');
index 0981858..d7eeb1d 100644 (file)
--- a/t/post.t
+++ b/t/post.t
@@ -28,26 +28,26 @@ use HTTP::Request::Common qw(GET POST);
 my $app = PostTest->new;
 sub run_request { $app->run_test_request(@_); }
 
-my $get = run_request(GET => 'http://localhost/');
+my $get = run_request(GET 'http://localhost/');
 
 cmp_ok($get->code, '==', 404, '404 on GET');
 
-my $no_body = run_request(POST => 'http://localhost/');
+my $no_body = run_request(POST 'http://localhost/');
 
 cmp_ok($no_body->code, '==', 404, '404 with empty body');
 
-my $no_foo = run_request(POST => 'http://localhost/' => [ bar => 'BAR' ]);
+my $no_foo = run_request(POST 'http://localhost/' => [ bar => 'BAR' ]);
 
 cmp_ok($no_foo->code, '==', 404, '404 with no foo param');
 
-my $no_bar = run_request(POST => 'http://localhost/' => [ foo => 'FOO' ]);
+my $no_bar = run_request(POST 'http://localhost/' => [ foo => 'FOO' ]);
 
 cmp_ok($no_bar->code, '==', 200, '200 with only foo param');
 
 is($no_bar->content, 'FOO EMPTY', 'bar defaulted');
 
 my $both = run_request(
-  POST => 'http://localhost/' => [ foo => 'FOO', bar => 'BAR' ]
+  POST 'http://localhost/' => [ foo => 'FOO', bar => 'BAR' ]
 );
 
 cmp_ok($both->code, '==', 200, '200 with both params');
@@ -68,7 +68,7 @@ cmp_ok($upload->code, '==', 200, '200 with multipart');
 is($upload->content, 'FOO BAR', 'both params returned');
 
 my $upload_wrongtype = run_request(
-  POST => 'http://localhost'
+  POST 'http://localhost'
     => [ baz => 'fleem' ]
 );
 
index 9801d9e..47b2a78 100644 (file)
@@ -140,14 +140,14 @@ cmp_ok $get_user->code, '==', 200,
     is ref($env), 'HASH', 'Got hashref';
 }
 
-ok my $post_user = run_request(POST => 'http://localhost/user/42', [id => '99'] ),
+ok my $post_user = run_request(POST => 'http://localhost/user/42', id => '99' ),
   'post user';
 
 cmp_ok $post_user->code, '==', 200,
   '200 on POST';
 
 {
-    my ($self, $params, $env, @noextra) = @{eval $post_user->content};
+    my ($self, $params, $env, @noextra) = @{eval $post_user->content or die $@};
     is scalar(@noextra), 0, 'No extra stuff';
     is ref($self), 't::Web::Simple::SubDispatchArgs', 'got object';
     is ref($params), 'HASH', 'Got POST hashref';