tests are passing
[catagits/CatalystX-Routes.git] / t / routes.t
1 use strict;
2 use warnings;
3
4 use Test::More 0.88;
5
6 use lib 't/lib';
7 use Catalyst::Test 'MyApp1';
8 use HTTP::Request::Common qw( GET PUT POST DELETE );
9
10 get('/foo');
11
12 is(
13     $MyApp1::Controller::C1::REQ{get}, 1,
14     'GET request for /foo went to the right sub'
15 );
16
17 request(
18     GET '/foo',
19     [
20         Accept => '*/*',
21     ]
22 );
23
24 is(
25     $MyApp1::Controller::C1::REQ{get_html}, 1,
26     'GET request for /foo that looks like a browser went to the right sub'
27 );
28
29 request( POST '/foo' );
30
31 is(
32     $MyApp1::Controller::C1::REQ{post}, 1,
33     'POST request for /foo went to the right sub'
34 );
35
36 request( PUT '/foo' );
37
38 is(
39     $MyApp1::Controller::C1::REQ{put}, 1,
40     'PUT request for /foo went to the right sub'
41 );
42
43 request( DELETE '/foo' );
44
45 is(
46     $MyApp1::Controller::C1::REQ{delete}, 1,
47     'DELETE request for /foo went to the right sub'
48 );
49
50 get('/normal');
51
52 is(
53     $MyApp1::Controller::C1::REQ{normal}, 1,
54     'GET request for /norma went to the right sub'
55 );
56
57 request( POST '/normal' );
58
59 is(
60     $MyApp1::Controller::C1::REQ{normal}, 2,
61     'POST request for /norma went to the right sub'
62 );
63
64 done_testing();