use strict;
use warnings;
-use Test::More no_plan => 1;
+use Test::More tests => 26;
use Test::Exception;
BEGIN {
{
package Stuff;
use Moose;
+ use MooseX::AttributeHelpers;
has 'options' => (
metaclass => 'Collection::Hash',
'get' => 'get_option',
'empty' => 'has_options',
'count' => 'num_options',
+ 'clear' => 'clear_options',
'delete' => 'delete_option',
}
);
has_options
num_options
delete_option
+ clear_options
];
ok(!$stuff->has_options, '... we have no options');
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';