| 1 | package Net::HTTP::Spore::Middleware::Mock; | ||||||||||
| 2 | 19 | $Net::HTTP::Spore::Middleware::Mock::VERSION = '0.09'; | |||||||||
| 3 | # ABSTRACT: Simple Mocker for Spore middlewares | ||||||||||
| 4 | |||||||||||
| 5 | 19 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 19 | extends 'Net::HTTP::Spore::Middleware'; | |||||||||
| 7 | |||||||||||
| 8 | 19 | has tests => ( isa => 'HashRef', is => 'ro', required => 1 ); | |||||||||
| 9 | |||||||||||
| 10 | 24 | ▶ | sub call { | ||||||||
|
Subroutine
call: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 11 | 24 | my ( $self, $req ) = @_; | |||||||||
| 12 | |||||||||||
| 13 | 24 | my $finalized_request = $req->finalize; | |||||||||
| 14 | 24 | foreach my $r ( keys %{ $self->tests } ) { | |||||||||
| 15 | 29 | ▶ | next unless $r eq $finalized_request->uri->path; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 24 | my $res = $self->tests->{$r}->($req); | |||||||||
| 17 | 23 | ▶ | return $res if defined $res; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | } | ||||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 19 | 1; | |||||||||
| 22 | |||||||||||
| 23 | __END__ | ||||||||||