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