6 use Test::More tests => 14;
7 use Test::Moose 'does_ok';
10 use_ok('Moose::AttributeHelpers');
18 traits => [qw/Counter/],
25 reset => 'reset_counter',
30 my $page = MyHomePage->new();
31 isa_ok($page, 'MyHomePage');
33 can_ok($page, $_) for qw[
39 is($page->counter, 0, '... got the default value');
42 is($page->counter, 1, '... got the incremented value');
45 is($page->counter, 2, '... got the incremented value (again)');
48 is($page->counter, 1, '... got the decremented value');
51 is($page->counter, 0, '... got the original value');
55 my $counter = $page->meta->get_attribute('counter');
56 does_ok($counter, 'Moose::AttributeHelpers::Trait::Counter');
58 is($counter->helper_type, 'Num', '... got the expected helper type');
60 is($counter->type_constraint->name, 'Int', '... got the expected type constraint');
62 is_deeply($counter->provides, {
65 reset => 'reset_counter',
66 }, '... got the right provides methods');