From: Sebastian Riedel Date: Thu, 8 Dec 2005 00:58:30 +0000 (+0000) Subject: Fixed tests X-Git-Tag: 5.7099_04~787 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=d1cbffb43413c2e8500d6f9e50bf1d120fdc54af Fixed tests --- diff --git a/t/live_component_controller_action_default.t b/t/live_component_controller_action_default.t index 1a2e545..d0922ec 100644 --- a/t/live_component_controller_action_default.t +++ b/t/live_component_controller_action_default.t @@ -10,7 +10,7 @@ our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; } -use Test::More tests => 12*$iters; +use Test::More tests => 12 * $iters; use Catalyst::Test 'TestApp'; if ( $ENV{CAT_BENCHMARK} ) { @@ -29,7 +29,7 @@ sub run_tests { TestApp::Controller::Action::Default->begin TestApp::Controller::Action::Default->default TestApp::View::Dump::Request->process - TestApp->end + TestApp->end ]; my $expected = join( ", ", @expected ); @@ -53,16 +53,20 @@ sub run_tests { ); ok( $response = request('http://localhost/foo/bar/action'), 'Request' ); - is( $response->code, 404, 'Invalid URI returned 404' ); + is( $response->code, 500, 'Invalid URI returned 500' ); } - + # test that args are passed properly to default { my $creq; - my $expected = [ qw/action default arg1 arg2/ ]; - - ok( my $response = request('http://localhost/action/default/arg1/arg2'), 'Request' ); - ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); + my $expected = [qw/action default arg1 arg2/]; + + ok( my $response = request('http://localhost/action/default/arg1/arg2'), + 'Request' ); + ok( + eval '$creq = ' . $response->content, + 'Unserialize Catalyst::Request' + ); is_deeply( $creq->{arguments}, $expected, 'Arguments ok' ); } } diff --git a/t/live_engine_reponse_errors.t b/t/live_engine_reponse_errors.t index 7f7c366..7579135 100644 --- a/t/live_engine_reponse_errors.t +++ b/t/live_engine_reponse_errors.t @@ -9,31 +9,52 @@ use lib "$FindBin::Bin/lib"; use Test::More tests => 18; use Catalyst::Test 'TestApp'; -close STDERR; # i'm naughty :) +close STDERR; # i'm naughty :) { - ok( my $response = request('http://localhost/engine/response/errors/one'), 'Request' ); + ok( my $response = request('http://localhost/engine/response/errors/one'), + 'Request' ); ok( $response->is_error, 'Response Server Error 5xx' ); - is( $response->code, 500, 'Response Code' ); + is( $response->code, 500, 'Response Code' ); is( $response->content_type, 'text/html', 'Response Content-Type' ); - is( $response->header('X-Catalyst-Action'), 'engine/response/errors/one', 'Test Action' ); - like( $response->header('X-Catalyst-Error'), qr/^Caught exception/, 'Catalyst Error' ); + is( $response->header('X-Catalyst-Action'), + 'engine/response/errors/one', 'Test Action' ); + like( + $response->header('X-Catalyst-Error'), + qr/^Caught exception/, + 'Catalyst Error' + ); } { - ok( my $response = request('http://localhost/engine/response/errors/two'), 'Request' ); - ok( $response->is_error, 'Client Error 4xx' ); - is( $response->code, 404, 'Response Code' ); + ok( my $response = request('http://localhost/engine/response/errors/two'), + 'Request' ); + ok( $response->is_error, 'Response Server Error 5xx' ); + is( $response->code, 500, 'Response Code' ); is( $response->content_type, 'text/html', 'Response Content-Type' ); - is( $response->header('X-Catalyst-Action'), 'engine/response/errors/two', 'Test Action' ); - like( $response->header('X-Catalyst-Error'), qr/^Couldn't forward to/, 'Catalyst Error' ); + is( $response->header('X-Catalyst-Action'), + 'engine/response/errors/two', 'Test Action' ); + like( + $response->header('X-Catalyst-Error'), + qr/^Couldn't forward to/, + 'Catalyst Error' + ); } { - ok( my $response = request('http://localhost/engine/response/errors/three'), 'Request' ); + ok( my $response = request('http://localhost/engine/response/errors/three'), + 'Request' ); ok( $response->is_error, 'Response Server Error 5xx' ); - is( $response->code, 500, 'Response Code' ); + is( $response->code, 500, 'Response Code' ); is( $response->content_type, 'text/html', 'Response Content-Type' ); - is( $response->header('X-Catalyst-Action'), 'engine/response/errors/three', 'Test Action' ); - like( $response->header('X-Catalyst-Error'), qr/^Caught exception "I'm going to die!"$/, 'Catalyst Error' ); + is( + $response->header('X-Catalyst-Action'), + 'engine/response/errors/three', + 'Test Action' + ); + like( + $response->header('X-Catalyst-Error'), + qr/^Caught exception "I'm going to die!"$/, + 'Catalyst Error' + ); }