X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F020_attributes%2F017_attribute_traits_n_meta.t;h=2aa111496e993e41546d6c969849cec6d0cb1eab;hb=246bbeef5959385671be705c87715042b049d41d;hp=6930dc1f21476520dd03570c3020c601ba06afa0;hpb=2de7e794802978ca04f5f2c1fe20cb62c9c43706;p=gitmo%2FMoose.git diff --git a/t/020_attributes/017_attribute_traits_n_meta.t b/t/020_attributes/017_attribute_traits_n_meta.t index 6930dc1..2aa1114 100644 --- a/t/020_attributes/017_attribute_traits_n_meta.t +++ b/t/020_attributes/017_attribute_traits_n_meta.t @@ -3,39 +3,37 @@ use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 7; use Test::Exception; use Test::Moose; -BEGIN { - use_ok('Moose'); -} + { package My::Meta::Attribute::DefaultReadOnly; use Moose; - + extends 'Moose::Meta::Attribute'; - + around 'new' => sub { my $next = shift; my ($self, $name, %options) = @_; - $options{is} = 'ro' + $options{is} = 'ro' unless exists $options{is}; $next->($self, $name, %options); - }; + }; } { package My::Attribute::Trait; use Moose::Role; - + has 'alias_to' => (is => 'ro', isa => 'Str'); - + after 'install_accessors' => sub { my $self = shift; $self->associated_class->add_method( - $self->alias_to, + $self->alias_to, $self->get_read_method_ref ); }; @@ -44,7 +42,7 @@ BEGIN { { package My::Class; use Moose; - + has 'bar' => ( metaclass => 'My::Meta::Attribute::DefaultReadOnly', traits => [qw/My::Attribute::Trait/],