now uses faster methods for accessors and some other minor cleanup stuff
[gitmo/MooseX-AttributeHelpers.git] / t / 001_basic_counter.t
index 5430d44..ff63f2c 100644 (file)
@@ -19,8 +19,9 @@ BEGIN {
         isa       => 'Int',
         default   => sub { 0 },
         provides  => {
-            inc => 'inc_counter',
-            dec => 'dec_counter',
+            inc   => 'inc_counter',
+            dec   => 'dec_counter',
+            reset => 'reset_counter',
         }
     );
 }
@@ -31,6 +32,7 @@ isa_ok($page, 'MyHomePage');
 can_ok($page, $_) for qw[
     dec_counter 
     inc_counter
+    reset_counter
 ];
 
 is($page->counter, 0, '... got the default value');
@@ -44,6 +46,9 @@ is($page->counter, 2, '... got the incremented value (again)');
 $page->dec_counter; 
 is($page->counter, 1, '... got the decremented value');
 
+$page->reset_counter;
+is($page->counter, 0, '... got the original value');
+
 # check the meta ..
 
 my $counter = $page->meta->get_attribute('counter');
@@ -54,7 +59,8 @@ is($counter->helper_type, 'Num', '... got the expected helper type');
 is($counter->type_constraint->name, 'Int', '... got the expected type constraint');
 
 is_deeply($counter->provides, { 
-    inc => 'inc_counter',
-    dec => 'dec_counter',    
+    inc   => 'inc_counter',
+    dec   => 'dec_counter',
+    reset => 'reset_counter',        
 }, '... got the right provides methods');