File Coverage

File:t/route-methods.t
Coverage:90.3%

linestmtbrancondsubpodtimecode
1#!/usr/bin/env perl -w
2
1
1
1
99
10
10
use strict;
3
1
1
1
109
5
18
use Test::More tests => 2;
4
1
1
1
88
6
5
use Moose ();
5
6
1
1
1
108
7
15
use Railsish::Router;
7
8Railsish::Router->draw(
9    sub {
10
1
6
        my ($map) = @_;
11
1
16
        $map->connect(
12            "/photos",
13            controller => "photos",
14            action => "create",
15            conditions => { method => 'post' }
16        );
17
18
1
30
        $map->connect(
19            "/photos",
20            controller => "photos",
21            action => "index",
22            conditions => { method => 'get' }
23        );
24    }
25
1
22
);
26
27{
28
1
1
11
12
    my $matched = Railsish::Router->match("/photos", conditions => { method => "get" });
29
30
1
9
    if ($matched) {
31
1
10
        my $mapping = $matched->mapping;
32
1
24
        is $mapping->{controller}, "photos";
33
1
7
        is $mapping->{action}, "index";
34    } else {
35
0
0
0
0
        fail "Not maching /dashboard/1234/12/21" for 1..2;
36    }
37}