7 use lib "$FindBin::Bin/lib";
11 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
13 use Test::More tests => 21 * $iters;
14 use Catalyst::Test 'TestApp';
16 if ( $ENV{CAT_BENCHMARK} ) {
18 Benchmark::timethis( $iters, \&run_tests );
28 ok( my $response = request('http://localhost/action_action_one'),
30 ok( $response->is_success, 'Response Successful 2xx' );
31 is( $response->content_type, 'text/plain', 'Response Content-Type' );
32 is( $response->header('X-Catalyst-Action'),
33 'action_action_one', 'Test Action' );
35 $response->header('X-Test-Class'),
36 'TestApp::Controller::Action::Action',
39 is( $response->header('X-Action'), 'works' );
42 qr/^bless\( .* 'Catalyst::Request' \)$/s,
43 'Content is a serialized Catalyst::Request'
48 ok( my $response = request('http://localhost/action_action_two'),
50 ok( $response->is_success, 'Response Successful 2xx' );
51 is( $response->content_type, 'text/plain', 'Response Content-Type' );
52 is( $response->header('X-Catalyst-Action'),
53 'action_action_two', 'Test Action' );
55 $response->header('X-Test-Class'),
56 'TestApp::Controller::Action::Action',
59 is( $response->header('X-Action-After'), 'awesome' );
62 qr/^bless\( .* 'Catalyst::Request' \)$/s,
63 'Content is a serialized Catalyst::Request'
70 request('http://localhost/action_action_three/one/two'),
73 ok( $response->is_success, 'Response Successful 2xx' );
74 is( $response->content_type, 'text/plain', 'Response Content-Type' );
75 is( $response->header('X-Catalyst-Action'),
76 'action_action_three', 'Test Action' );
78 $response->header('X-Test-Class'),
79 'TestApp::Controller::Action::Action',
82 is( $response->header('X-TestAppActionTestBefore'), 'one' );
85 qr/^bless\( .* 'Catalyst::Request' \)$/s,
86 'Content is a serialized Catalyst::Request'