~ubuntu-branches/ubuntu/trusty/libtest-roo-perl/trusty-proposed

« back to all changes in this revision

Viewing changes to examples/cookbook/hookable_test.t

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2014-01-14 19:25:11 UTC
  • Revision ID: package-import@ubuntu.com-20140114192511-9ycl4dc1zgamfnek
Tags: upstream-1.002
ImportĀ upstreamĀ versionĀ 1.002

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use Test::Roo;
 
2
 
 
3
has counter => ( is => 'rw', default => sub { 0 } );
 
4
 
 
5
sub is_positive {
 
6
    my $self = shift;
 
7
    ok( $self->counter > 0, "counter is positive" );
 
8
}
 
9
 
 
10
before is_positive => sub { shift->counter( 1 ) };
 
11
 
 
12
test 'hookable' => sub { shift->is_positive };
 
13
 
 
14
run_me;
 
15
done_testing;