adding in the new junk to this
[gitmo/MooseX-AttributeHelpers.git] / t / 003_basic_hash.t
index 164de56..c0b3a2a 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More no_plan => 1;
+use Test::More tests => 26;
 use Test::Exception;
 
 BEGIN {
@@ -13,6 +13,7 @@ BEGIN {
 {
     package Stuff;
     use Moose;
+    use MooseX::AttributeHelpers;
 
     has 'options' => (
         metaclass => 'Collection::Hash',
@@ -20,10 +21,12 @@ BEGIN {
         isa       => 'HashRef[Str]',
         default   => sub { {} },
         provides  => {
-            'set'   => 'set_option',
-            'get'   => 'get_option',            
-            'empty' => 'has_options',
-            'count' => 'num_options',
+            'set'    => 'set_option',
+            'get'    => 'get_option',            
+            'empty'  => 'has_options',
+            'count'  => 'num_options',
+            'clear'  => 'clear_options',
+            'delete' => 'delete_option',
         }
     );
 }
@@ -36,6 +39,8 @@ can_ok($stuff, $_) for qw[
     get_option
     has_options
     num_options
+    delete_option
+    clear_options
 ];
 
 ok(!$stuff->has_options, '... we have no options');
@@ -61,6 +66,17 @@ is_deeply($stuff->options, { foo => 'bar', bar => 'baz' }, '... got more options
 is($stuff->get_option('foo'), 'bar', '... got the right option');
 
 lives_ok {
+    $stuff->delete_option('bar');
+} '... deleted the option okay';
+
+is($stuff->num_options, 1, '... we have 1 option(s)');
+is_deeply($stuff->options, { foo => 'bar' }, '... got more options now');
+
+$stuff->clear_options;
+
+is_deeply($stuff->options, { }, "... cleared options" );
+
+lives_ok {
     Stuff->new(options => { foo => 'BAR' });
 } '... good constructor params';