X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F402-attribute-application.t;h=23ff3a2045924f8e3d038f38ccbb277d7253d219;hb=0a3a19a177bb02cb49c2e01004d193bf68eb767c;hp=d05f818d997eca88f4e9b75a03cc362dd988cfb1;hpb=efe59893963a4bc4a8d11ad77059ca8b23c5a8c8;p=gitmo%2FMouse.git diff --git a/t/402-attribute-application.t b/t/402-attribute-application.t index d05f818..23ff3a2 100644 --- a/t/402-attribute-application.t +++ b/t/402-attribute-application.t @@ -1,8 +1,8 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 5; -use Test::Exception; +use Test::More tests => 11; +use Mouse::Util ':test'; do { package Role; @@ -48,3 +48,37 @@ lives_ok { is(Class2->meta->get_attribute('attr')->default, 'Role'); +lives_ok { + package Class3; + use Mouse; + + with 'Role'; + + has attr => ( + default => 'Class3', + ); +}; + +is(Class3->meta->get_attribute('attr')->default, 'Class3'); + +lives_ok { + package Class::Parent; + use Mouse; + + has attr => ( + default => 'Class::Parent', + ); +}; + +is(Class::Parent->meta->get_attribute('attr')->default, 'Class::Parent', 'local class wins over the role'); + +lives_ok { + package Class::Child; + use Mouse; + + extends 'Class::Parent'; + + with 'Role'; +}; + +is(Class::Child->meta->get_attribute('attr')->default, 'Role', 'role wins over the parent method');