X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F001_basic.t;h=3133f4a32c2a0fdd3cda11364d4e7a08adb76f2f;hb=b9238462c9d0e46830c5bd0ce94771826c1079a4;hp=cdc3c2ba88b48dfc47dbf8d2f86045cdd9a1d006;hpb=b14c8df5cc7592d2ee2b1b50080c416cfcb703e5;p=gitmo%2FMoose-Policy.git diff --git a/t/001_basic.t b/t/001_basic.t index cdc3c2b..3133f4a 100644 --- a/t/001_basic.t +++ b/t/001_basic.t @@ -15,7 +15,7 @@ BEGIN { extends 'Moose::Meta::Attribute'; - before '_process_options' => sub { + sub _process_options { my ($class, $name, $options) = @_; if (exists $options->{is}) { if ($options->{is} eq 'ro') { @@ -27,12 +27,39 @@ BEGIN { } delete $options->{is}; } - }; + + $class->SUPER::_process_options($name, $options); + } } - { package My::Moose::Policy; + use constant attribute_metaclass => 'My::Moose::Meta::Attribute'; +} + +{ + package Foo; + use Moose::Policy 'My::Moose::Policy'; + use Moose; -} \ No newline at end of file + has 'bar' => (default => 'Foo::bar'); +} + +isa_ok(Foo->meta, 'Moose::Meta::Class'); +is(Foo->meta->attribute_metaclass, 'My::Moose::Meta::Attribute', '... got our custom attr metaclass'); + +isa_ok() + +my $foo = Foo->new; +isa_ok($foo, 'Foo'); + +can_ok($foo, 'get_bar'); +can_ok($foo, 'set_bar'); + +is($foo->get_bar, 'Foo::bar', '... got the right default value'); + + + + +