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