X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F402-attribute-application.t;h=fbb400d8c063d26a434d684e5bddbce15c7269f5;hb=34a904850107fd3cf9ef58ae155af24c7dd71fe7;hp=d05f818d997eca88f4e9b75a03cc362dd988cfb1;hpb=efe59893963a4bc4a8d11ad77059ca8b23c5a8c8;p=gitmo%2FMouse.git diff --git a/t/402-attribute-application.t b/t/402-attribute-application.t index d05f818..fbb400d 100644 --- a/t/402-attribute-application.t +++ b/t/402-attribute-application.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 11; use Test::Exception; do { @@ -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');