Convert all tests to done_testing.
[gitmo/Moose.git] / t / 070_native_traits / 020_remove_attribute.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Exception;
8
9 {
10     package MyHomePage;
11     use Moose;
12
13     has 'counter' => (
14         traits  => ['Counter'],
15         is      => 'ro',
16         isa     => 'Int',
17         default => 0,
18         handles => {
19             inc_counter   => 'inc',
20             dec_counter   => 'dec',
21             reset_counter => 'reset',
22         }
23     );
24 }
25
26 my $page = MyHomePage->new();
27 isa_ok( $page, 'MyHomePage' );
28
29 can_ok( $page, $_ ) for qw[
30     counter
31     dec_counter
32     inc_counter
33     reset_counter
34 ];
35
36 lives_ok {
37     $page->meta->remove_attribute('counter');
38 }
39 '... removed the counter attribute okay';
40
41 ok( !$page->meta->has_attribute('counter'),
42     '... no longer has the attribute' );
43
44 ok( !$page->can($_), "... our class no longer has the $_ method" ) for qw[
45     counter
46     dec_counter
47     inc_counter
48     reset_counter
49 ];
50
51 done_testing;