possibly fix frang's problem
[catagits/Catalyst-Plugin-Authentication.git] / t / 06_user.t
CommitLineData
9985827d 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
fa194d25 6use Test::More tests => 6;
9985827d 7use Test::Exception;
8
9my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Authentication::User") }
10
11{
12 package SomeUser;
13 use base $m;
14
15 sub new { bless {}, shift };
16
17 sub supported_features {
18 {
19 feature => {
20 subfeature => 1,
21 unsupported_subfeature => 0,
22 },
23 top_level => 1,
24 }
25 }
26}
27
28my $o = SomeUser->new;
29
30can_ok( $m, "supports" );
31
32ok( $o->supports("top_level"), "simple top level feature check");
33ok( $o->supports(qw/feature subfeature/), "traversal");
34ok( !$o->supports(qw/feature unsupported_subfeature/), "traversal terminating in false");
35
36lives_ok {
37 $o->supports("bad_key");
fa194d25 38} "can check for non existent feature";
9985827d 39
fa194d25 40#dies_ok {
41# $o->supports(qw/bad_key subfeature/)
42#} "but can't traverse into one";
9985827d 43
44