Regenerate test files
[gitmo/Mouse.git] / t / 070_native_traits / 020_remove_attribute.t
1 #!/usr/bin/perl
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5
6 use strict;
7 use warnings;
8
9 use Test::More;
10 $TODO = q{Mouse is not yet completed};
11 use Test::Exception;
12
13 {
14     package MyHomePage;
15     use Mouse;
16
17     has 'counter' => (
18         traits  => ['Counter'],
19         is      => 'ro',
20         isa     => 'Int',
21         default => 0,
22         handles => {
23             inc_counter   => 'inc',
24             dec_counter   => 'dec',
25             reset_counter => 'reset',
26         }
27     );
28 }
29
30 my $page = MyHomePage->new();
31 isa_ok( $page, 'MyHomePage' );
32
33 can_ok( $page, $_ ) for qw[
34     counter
35     dec_counter
36     inc_counter
37     reset_counter
38 ];
39
40 lives_ok {
41     $page->meta->remove_attribute('counter');
42 }
43 '... removed the counter attribute okay';
44
45 ok( !$page->meta->has_attribute('counter'),
46     '... no longer has the attribute' );
47
48 ok( !$page->can($_), "... our class no longer has the $_ method" ) for qw[
49     counter
50     dec_counter
51     inc_counter
52     reset_counter
53 ];
54
55 done_testing;