6 use Test::More tests => 14;
10 use_ok('Moose::AttributeHelpers');
17 has 'counter' => (traits => ['Counter']);
20 my $page = MyHomePage->new();
21 isa_ok($page, 'MyHomePage');
23 can_ok($page, $_) for qw[
29 is($page->counter, 0, '... got the default value');
32 is($page->counter, 1, '... got the incremented value');
35 is($page->counter, 2, '... got the incremented value (again)');
38 is($page->counter, 1, '... got the decremented value');
41 is($page->counter, 0, '... got the original value');
45 my $counter = $page->meta->get_attribute('counter');
46 does_ok($counter, 'Moose::AttributeHelpers::Trait::Counter');
48 is($counter->helper_type, 'Num', '... got the expected helper type');
50 is($counter->type_constraint->name, 'Num', '... got the expected default type constraint');
52 is_deeply($counter->handles, {
53 'inc_counter' => 'inc',
54 'dec_counter' => 'dec',
55 'reset_counter' => 'reset',
56 'set_counter' => 'set',
57 }, '... got the right default handles methods');