lib/Gitalist/Controller/Fragment.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 44 CC 3 SCAR 18.4
CC
3
Cov
0%
collectionofrepositories
12.0
BEGIN
2.0
base
2.0
CRAP 6.3
1 package Gitalist::Controller::Fragment;
2  
3 use Moose;
4 use namespace::autoclean;
5  
6 BEGIN { extends 'Gitalist::Controller' }
7  
8 sub base : Chained('/base') PathPart('fragment') CaptureArgs(0) {
9 my ($self, $c) = @_;
10 $c->stash(no_wrapper => 1);
11 }
12  
13 sub collectionofrepositories : Chained('base') Args(0) {
14 my ($self, $c) = @_;
15 my @list = @{ $c->model()->repositories };
16 die 'No repositories found in '. ref($c->model) . ' ' . $c->model->debug_string
17 unless @list;
18  
19 my $search = $c->req->param('s') || '';
20 if($search) {
21 @list = grep {
22 index($_->name, $search) > -1
23 or ( $_->description !~ /^Unnamed repository/ and index($_->description, $search) > -1 )
24 } @list
25 }
26  
27 $c->stash(
28 repositories => \@list,
29 );
30 }
31  
32 __PACKAGE__->meta->make_immutable;