root/Catalyst-View-Jemplate/trunk/t/01_live.t

Revision 2111 (checked in by miyagawa, 14 years ago)

patch from dmaki

  • Property svn:mime-type set to text/plain
Line 
1 use strict;
2 use warnings;
3
4 use FindBin;
5 use lib "$FindBin::Bin/lib";
6
7 use Test::More tests => 12;
8 use Catalyst::Test 'TestApp';
9
10 BEGIN {
11     no warnings 'redefine';
12
13     *Catalyst::Test::local_request = sub {
14         my ( $class, $request ) = @_;
15
16         require HTTP::Request::AsCGI;
17         my $cgi = HTTP::Request::AsCGI->new( $request, %ENV )->setup;
18
19         $class->handle_request;
20
21         return $cgi->restore->response;
22     };
23 }
24
25 my $entrypoint = "http://localhost/jemplate";
26
27 {
28     my $request = HTTP::Request->new( GET => $entrypoint );
29
30     ok( my $response = request($request), 'Request' );
31     ok( $response->is_success, 'Response Successful 2xx' );
32     is( $response->code, 200, 'Response Code' );
33
34     is_deeply( [ $response->content_type ], [ 'text/javascript', 'charset=utf-8' ] );
35
36     like $response->content, qr!//line 1 "foo\.tt"!;
37     like $response->content, qr!//line 1 "bar\.tt"!;
38 }
39
40 {
41     my $request = HTTP::Request->new( GET => "http://localhost/selected" );
42
43     ok( my $response = request($request), 'Request' );
44     ok( $response->is_success, 'Response Successful 2xx' );
45     is( $response->code, 200, 'Response Code' );
46
47     is_deeply( [ $response->content_type ], [ 'text/javascript', 'charset=utf-8' ] );
48
49     unlike $response->content, qr!//line 1 "foo\.tt"!;
50     like $response->content, qr!//line 1 "bar\.tt"!;
51 }
Note: See TracBrowser for help on using the browser.