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