6 use Test::More tests => 16;
7 use Test::Moose 'does_ok';
12 use Moose::AttributeHelpers;
15 traits => ['Counter'],
22 reset_counter => 'reset',
28 my $page = MyHomePage->new();
29 isa_ok( $page, 'MyHomePage' );
31 can_ok( $page, $_ ) for qw[
38 is( $page->counter, 0, '... got the default value' );
41 is( $page->counter, 1, '... got the incremented value' );
44 is( $page->counter, 2, '... got the incremented value (again)' );
47 is( $page->counter, 1, '... got the decremented value' );
50 is( $page->counter, 0, '... got the original value' );
52 $page->set_counter(5);
53 is( $page->counter, 5, '... set the value' );
55 $page->inc_counter(2);
56 is( $page->counter, 7, '... increment by arg' );
58 $page->dec_counter(5);
59 is( $page->counter, 2, '... decrement by arg' );
63 my $counter = $page->meta->get_attribute('counter');
64 does_ok( $counter, 'Moose::AttributeHelpers::Trait::Counter' );
66 is( $counter->type_constraint->name, 'Int',
67 '... got the expected type constraint' );
74 reset_counter => 'reset',
77 '... got the right handles methods'