Clean up some more tabs and whitespaces.
[catagits/Catalyst-Plugin-Authentication.git] / t / 06_user.t
CommitLineData
9985827d 1use strict;
2use warnings;
3
4b33bb96 4use Test::More;
9985827d 5use Test::Exception;
6
5c5af345 7my $m; BEGIN { use_ok($m = "Catalyst::Authentication::User") }
9985827d 8
9{
4b33bb96 10 package SomeBaseUser;
11 sub other_method { 'FNAR' };
12}
13
14{
9985827d 15 package SomeUser;
16 use base $m;
17
18 sub new { bless {}, shift };
19
20 sub supported_features {
21 {
22 feature => {
23 subfeature => 1,
24 unsupported_subfeature => 0,
25 },
26 top_level => 1,
27 }
28 }
4b33bb96 29 sub get_object {
30 bless {}, 'SomeBaseUser';
31 }
9985827d 32}
33
34my $o = SomeUser->new;
35
36can_ok( $m, "supports" );
37
38ok( $o->supports("top_level"), "simple top level feature check");
39ok( $o->supports(qw/feature subfeature/), "traversal");
40ok( !$o->supports(qw/feature unsupported_subfeature/), "traversal terminating in false");
41
42lives_ok {
43 $o->supports("bad_key");
fa194d25 44} "can check for non existent feature";
9985827d 45
fa194d25 46#dies_ok {
47# $o->supports(qw/bad_key subfeature/)
48#} "but can't traverse into one";
9985827d 49
4b33bb96 50lives_ok {
51 is $o->other_method, 'FNAR', 'Delegation onto user object works';
52} 'Delegation lives';
53
54done_testing;
55
9985827d 56