6 use Test::More tests => 39;
8 use Test::WWW::Mechanize::Catalyst 'Catty';
10 my $root = "http://localhost";
12 my $m = Test::WWW::Mechanize::Catalyst->new( autocheck => 0 );
15 is( $m->ct, "text/html" );
17 $m->content_contains("This is the root page");
19 $m->follow_link_ok( { text => 'Hello' } );
20 is( $m->base, "http://localhost/hello/" );
21 is( $m->ct, "text/html" );
22 $m->title_is("Hello");
23 $m->content_contains( Encode::decode( 'utf-8', "Hi there! ☺" ) );
25 #use Devel::Peek; Dump $m->content;
26 #Dump(Encode::decode('utf-8', "Hi there! ☺"));
30 is( $m->ct, "text/html" );
32 $m->content_contains("This is the root page");
34 $m->get_ok("http://example.com/");
35 is( $m->ct, "text/html" );
37 $m->content_contains("This is the root page");
39 $m->get_ok("/hello/");
40 is( $m->ct, "text/html" );
41 $m->title_is("Hello");
42 $m->content_contains( Encode::decode( 'utf-8', "Hi there! ☺" ) );
45 eval { require Compress::Zlib; };
46 skip "Compress::Zlib needed to test gzip encoding", 4 if $@;
47 $m->get_ok("/gzipped/");
48 is( $m->ct, "text/html" );
49 $m->title_is("Hello");
50 $m->content_contains( Encode::decode( 'utf-8', "Hi there! ☺" ) );
53 $m->get("$root/die/");
54 is( $m->status, 500 );
60 is( $m->status, 500 );
65 $m->{catalyst_debug} = 1;
66 $m->get("$root/die/");
67 is( $m->status, 500 );
68 is( $m->ct, "text/html" );
69 $m->title_like(qr/Catty on Catalyst/);
70 $m->content_like(qr/Caught exception in Catty/);
71 $m->content_like(qr/erk/);
72 $m->content_like(qr/This is the die page/);