From: Upasana Date: Thu, 9 Jan 2014 17:10:39 +0000 (+0530) Subject: Wrote tests for Plack::Middleware::RemoveRedundantBody X-Git-Tag: 5.90060~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=9693c763ee422d234a5169a8d728515fa711ea32 Wrote tests for Plack::Middleware::RemoveRedundantBody --- diff --git a/t/remove_redundant_body.t b/t/remove_redundant_body.t new file mode 100644 index 0000000..a43026c --- /dev/null +++ b/t/remove_redundant_body.t @@ -0,0 +1,35 @@ +use FindBin; +use lib "$FindBin::Bin/lib"; +use Catalyst::Test 'TestApp', {default_host => 'default.com'}; +use Catalyst::Request; + +use Test::More; + +{ + my @routes = ( + ["test_remove_body_with_304", + 304 ], + ["test_remove_body_with_204", + 204 ], + ["test_remove_body_with_100", + 100 ], + ["test_nobody_with_100", + 100 ] + ); + + foreach my $element (@routes ) { + my $route = $element->[0]; + my $expected_code = $element->[1]; + my $request = + HTTP::Request->new( GET => "http://localhost:3000/$route" ); + ok( my $response = request($request), "Request for $route"); + is( $response->code, + $expected_code, + "Status code for $route is $expected_code"); + is( $response->content, + '', + "Body for $route is not present"); + } +} + +done_testing;