Commit | Line | Data |
68af3866 |
1 | #!/usr/bin/env perl |
2 | use warnings; |
3 | use strict; |
4 | use Test::More qw/no_plan/; |
5 | |
6 | { |
7 | package TestApp; |
8 | use parent qw/Catalyst/; |
9 | use parent qw/Catalyst::Controller/; |
10 | __PACKAGE__->setup(); |
11 | |
12 | sub thing :Path { |
13 | my ($self, $c, @path) = @_; |
14 | $c->res->body(join "/", @path); |
15 | } |
16 | sub another :Path('something') { |
17 | my ($self, $c) = @_; |
18 | $c->forward('thing'); |
19 | } |
20 | sub thing_uri :Path('thing_uri') { |
21 | my ($self, $c, @path) = @_; |
22 | $c->res->body($c->uri_for(@path)); |
23 | } |
24 | } |
25 | |
26 | use_ok "Catalyst::Test", "TestApp"; |
27 | my $req_path = 'foo/bar/baz quoxx{fnord}'; |
28 | my $req = request("/$req_path"); |
29 | ok($req->is_success, 'request succeeds'); |
30 | is($req->content, $req_path, "returned path is identical to received path"); |
31 | $req = request("/something/$req_path"); |
32 | ok($req->is_success, 'request succeeds'); |
33 | is($req->content, $req_path, "returned path is identical to received path 2"); |
34 | $req = request("/thing_uri/$req_path"); |
35 | ok($req->is_success, 'request succeeds'); |
36 | is($req->content, "http://localhost/$req_path", "returned path is identical to received path 2"); |
37 | |