4 use Exporter qw/import/;
5 use Catalyst::Test qw/Gitalist/;
16 require Test::WWW::Mechanize::Catalyst;
17 Test::WWW::Mechanize::Catalyst->new(catalyst_app => 'Gitalist')
19 constant->import('MECH', $mech );
22 # Rechecking the same link multiple times is slow and lame!
23 # Nicked this from WWW::Mechanize and memoized it...
25 sub Test::WWW::Mechanize::Catalyst::page_links_ok {
29 $desc = 'All links ok' unless defined $desc;
31 my @links = $self->followable_links();
32 my @urls = Test::WWW::Mechanize::_format_links(\@links);
34 my @failures = $self->_check_links_status( [ grep { ! $seen_links{$_}++ } @urls ] );
35 my $ok = (@failures==0);
38 diag( $_ ) for @failures;
46 my $request = "/$uri";
47 $request .= "?$qs" if defined $qs;
48 my $response = request($request);
49 ok($response->is_success, "ok $request");
51 my $res = MECH()->get($request);
52 ok $res->is_success, "ok mech $request (" . $res->code . ')';
53 MECH()->page_links_ok("All links ok from $request")
54 if $res->content_type =~ m|text/html|;
61 my $to_curry = shift || \&test_uri;
64 $to_curry->("$prefix/$uri", @_);