Commit | Line | Data |
683d672b |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
0b0aee67 |
6 | use Data::Dumper; |
7 | $Data::Dumper::Maxdepth=1; |
683d672b |
8 | use FindBin; |
9 | use lib "$FindBin::Bin/../lib"; |
10 | |
0b0aee67 |
11 | use Test::More tests => 13; |
683d672b |
12 | use Catalyst::Test 'TestApp'; |
13 | |
0b0aee67 |
14 | sub ok_actions { |
15 | my ($response, $actions, $msg) = @_; |
16 | my $expected = join ", ", |
17 | (map { "TestApp::Controller::Attributes->$_" } @$actions), |
18 | 'TestApp::Controller::Root->end'; |
19 | is( $response->header('x-catalyst-executed') => $expected, |
2fe6ed83 |
20 | $msg || 'Executed correct acitons'); |
0b0aee67 |
21 | } |
22 | |
683d672b |
23 | ok( my $response = request('http://localhost/attributes/view'), |
24 | 'get /attributes/view' ); |
25 | ok( !$response->is_success, 'Response Unsuccessful' ); |
26 | |
27 | ok( $response = request('http://localhost/attributes/foo'), |
28 | "get /attributes/foo" ); |
0b0aee67 |
29 | ok_actions($response => ['foo']); |
30 | |
31 | ok( $response = request('http://localhost/attributes/all_attrs'), |
32 | "get /attributes/all_attrs" ); |
33 | ok( $response->is_success, "Response OK" ); |
34 | ok_actions($response => [qw/fetch all_attrs_action/]); |
683d672b |
35 | |
0b0aee67 |
36 | ok( $response = request('http://localhost/attributes/some_attrs'), |
37 | "get /attributes/some_attrs" ); |
683d672b |
38 | ok( $response->is_success, "Response OK" ); |
0b0aee67 |
39 | ok_actions($response => [qw/fetch some_attrs_action/]); |
40 | |
41 | ok( $response = request('http://localhost/attributes/one_attr'), |
42 | "get /attributes/one_attr" ); |
43 | ok( $response->is_success, "Response OK" ); |
44 | ok_actions($response => [qw/fetch one_attr_action/]); |
45 | |
46 | |