broken-test
[gitmo/Moose-Policy.git] / t / 001_basic.t
index cdc3c2b..618b56a 100644 (file)
@@ -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(Foo->meta->get_attribute('bar'), 'My::Moose::Meta::Attribute');
+
+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');
+
+
+
+
+