5 use Test::More tests => 27;
7 use Test::WWW::Mechanize::Catalyst 'Catty';
9 my $root = "http://localhost";
12 foreach my $where (qw{hi greetings bonjour}) {
13 $m = Test::WWW::Mechanize::Catalyst->new;
14 $m->get_ok( "$root/$where", "got something when we $where" );
16 is( $m->base, "http://localhost/hello", "check got to hello 1/4" );
17 is( $m->ct, "text/html", "check got to hello 2/4" );
18 $m->title_is( "Hello",, "check got to hello 3/4" );
19 $m->content_contains( "Hi there",, "check got to hello 4/4" );
21 # check that the previous response is still there
22 my $prev = $m->response->previous;
23 ok( $prev, "have a previous" );
24 is( $prev->code, 302, "was a redirect" );
25 like( $prev->header('Location'), '/hello$/', "to the right place" );
28 # extra checks for bonjour (which is a double redirect)
29 my $prev = $m->response->previous->previous;
30 ok( $prev, "have a previous previous" );
31 is( $prev->code, 302, "was a redirect" );
32 like( $prev->header('Location'), '/hi$/', "to the right place" );