File Coverage

blib/lib/Test/Spec/RMock/ExactlyConstraint.pm
Criterion Covered Total %
statement 6 6 100.0
branch 4 4 100.0
condition n/a
subroutine 3 3 100.0
pod 0 3 0.0
total 13 16 81.2


line stmt bran cond sub pod time code
1             package Test::Spec::RMock::ExactlyConstraint;
2              
3             sub new {
4 27     27 0 49 my ($class, $target) = @_;
5 27         280 bless { _target => $target }, $class;
6             }
7              
8             sub call {
9 61     61 0 76 my ($self, $times_called) = @_;
10 61         364 $times_called == $self->{_target};
11             }
12              
13             sub error_message {
14 4     4 0 11 my ($self, $mock_name, $name, $times_called) = @_;
15 4 100       48 sprintf "Expected '%s' to be called %d %s on '%s', but it was called %d %s.",
    100          
16             $name,
17             $self->{_target},
18             ($self->{_target} == 1 ? 'time' : 'times'),
19             $mock_name,
20             $times_called,
21             ($times_called == 1 ? 'time' : 'times');
22             }
23              
24             1;
25              
26             __END__