File Coverage

blib/lib/Test/Spec/RMock/AtLeastConstraint.pm
Criterion Covered Total %
statement 6 6 100.0
branch 1 2 50.0
condition n/a
subroutine 3 3 100.0
pod 0 3 0.0
total 10 14 71.4


line stmt bran cond sub pod time code
1             package Test::Spec::RMock::AtLeastConstraint;
2              
3             sub new {
4 3     3 0 4 my ($class, $bound) = @_;
5 3         20 bless { _bound => $bound }, $class;
6             }
7              
8             sub call {
9 9     9 0 12 my ($self, $times_called) = @_;
10 9         48 $times_called >= $self->{_bound};
11             }
12              
13             sub error_message {
14 2     2 0 3 my ($self, $mock_name, $name, $times_called) = @_;
15 2 50       22 sprintf "Expected '%s' to be called at least once on '%s', but called %d %s.",
16             $name, $mock_name, $times_called, ($times_called == 1 ? 'time' : 'times');
17             }
18              
19             1;
20              
21             __END__