X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F201_trait_counter.t;fp=t%2F201_trait_counter.t;h=cd281c0b4ba564a36f157ac89e0ab6479995146c;hb=301da83f19b55bb13e0d4379ab3e9e6ad1504595;hp=41875fd5ffc4fac5d552152942ac687a069c4138;hpb=fda444e70db8fa4a13c1a24dda315b506d45b839;p=gitmo%2FMooseX-AttributeHelpers.git diff --git a/t/201_trait_counter.t b/t/201_trait_counter.t index 41875fd..cd281c0 100644 --- a/t/201_trait_counter.t +++ b/t/201_trait_counter.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 18; use Test::Moose 'does_ok'; BEGIN { @@ -23,6 +23,7 @@ BEGIN { inc => 'inc_counter', dec => 'dec_counter', reset => 'reset_counter', + set => 'set_counter' } ); } @@ -34,6 +35,7 @@ can_ok($page, $_) for qw[ dec_counter inc_counter reset_counter + set_counter ]; is($page->counter, 0, '... got the default value'); @@ -50,6 +52,15 @@ is($page->counter, 1, '... got the decremented value'); $page->reset_counter; is($page->counter, 0, '... got the original value'); +$page->set_counter(5); +is($page->counter, 5, '... set the value'); + +$page->inc_counter(2); +is($page->counter, 7, '... increment by arg'); + +$page->dec_counter(5); +is($page->counter, 2, '... decrement by arg'); + # check the meta .. my $counter = $page->meta->get_attribute('counter'); @@ -62,6 +73,7 @@ is($counter->type_constraint->name, 'Int', '... got the expected type constraint is_deeply($counter->provides, { inc => 'inc_counter', dec => 'dec_counter', - reset => 'reset_counter', + reset => 'reset_counter', + set => 'set_counter' }, '... got the right provides methods');