X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F001_mouse%2F008-default.t;h=900fc698bbfe275c063cef32a23d8c4515a31b39;hb=HEAD;hp=f77d01b379172f5b88924e31949f6c18434b81cc;hpb=920139b3efca66d2caeeef306c97fa0da62c6b73;p=gitmo%2FMouse.git diff --git a/t/001_mouse/008-default.t b/t/001_mouse/008-default.t index f77d01b..900fc69 100644 --- a/t/001_mouse/008-default.t +++ b/t/001_mouse/008-default.t @@ -2,6 +2,7 @@ use strict; use warnings; use Test::More tests => 36; +use Test::Mouse; do { package Class; @@ -14,7 +15,7 @@ do { has 'y' => ( is => 'rw', - default => 20, + default => sub{ 20 }, ); has 'z' => ( @@ -22,7 +23,7 @@ do { ); }; -for(1 .. 2){ +with_immutable(sub{ my $object = Class->new; is($object->x, 10, "attribute has a default of 10"); is($object->y, 20, "attribute has a default of 20"); @@ -49,5 +50,4 @@ for(1 .. 2){ is($object2->y, 25, "setting a new value does not trigger default"); is($object2->z, 125, "setting a new value does not trigger default"); - Class->meta->make_immutable; -} +}, qw(Class));