* added typed-ness to collections
[gitmo/MooseX-AttributeHelpers.git] / t / 001_basic_counter.t
index 107314f..64cc641 100644 (file)
@@ -28,6 +28,9 @@ BEGIN {
 my $page = MyHomePage->new();
 isa_ok($page, 'MyHomePage');
 
+can_ok($page, 'inc_counter');
+can_ok($page, 'dec_counter');
+
 is($page->counter, 0, '... got the default value');
 
 $page->inc_counter; 
@@ -39,5 +42,17 @@ is($page->counter, 2, '... got the incremented value (again)');
 $page->dec_counter; 
 is($page->counter, 1, '... got the decremented value');
 
+# check the meta ..
+
+my $counter = $page->meta->get_attribute('counter');
+isa_ok($counter, 'MooseX::AttributeHelpers::Counter');
+
+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',    
+}, '... got the right provides methods');