X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F070_native_traits%2F020_remove_attribute.t;fp=t%2F070_native_traits%2F020_remove_attribute.t;h=670b06766160bd7b0550e89b5524688b0663b2b5;hb=fde8e43f95fe996fbc2a778aa259feeb04552171;hp=0000000000000000000000000000000000000000;hpb=0bdc9d38dfd3de07aad929f6629f8fa65d434c27;p=gitmo%2FMouse.git diff --git a/t/070_native_traits/020_remove_attribute.t b/t/070_native_traits/020_remove_attribute.t new file mode 100644 index 0000000..670b067 --- /dev/null +++ b/t/070_native_traits/020_remove_attribute.t @@ -0,0 +1,55 @@ +#!/usr/bin/perl +# This is automatically generated by author/import-moose-test.pl. +# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! +use t::lib::MooseCompat; + +use strict; +use warnings; + +use Test::More; +$TODO = q{Mouse is not yet completed}; +use Test::Exception; + +{ + package MyHomePage; + use Mouse; + + has 'counter' => ( + traits => ['Counter'], + is => 'ro', + isa => 'Int', + default => 0, + handles => { + inc_counter => 'inc', + dec_counter => 'dec', + reset_counter => 'reset', + } + ); +} + +my $page = MyHomePage->new(); +isa_ok( $page, 'MyHomePage' ); + +can_ok( $page, $_ ) for qw[ + counter + dec_counter + inc_counter + reset_counter +]; + +lives_ok { + $page->meta->remove_attribute('counter'); +} +'... removed the counter attribute okay'; + +ok( !$page->meta->has_attribute('counter'), + '... no longer has the attribute' ); + +ok( !$page->can($_), "... our class no longer has the $_ method" ) for qw[ + counter + dec_counter + inc_counter + reset_counter +]; + +done_testing;