1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use lib qw( t/lib );
6
7use Test::More 'no_plan';
8
9# application loads
10BEGIN { use_ok "Test::WWW::Mechanize::Catalyst" => "TestApp" }
11my $mech = Test::WWW::Mechanize::Catalyst->new;
12
13# basic Metadata processing - tables list
14for (qw( /site/mysite/schema/foobar /site/mysite )) {
15    $mech->get_ok($_, "Get tables list page ($_)");
16    is($mech->ct, 'text/html', "Tables list page content type ($_)");
17    $mech->content_contains(
18        q{please select a table},
19        "Tables list page content ($_)"
20    );
21}
22
23$mech->content_contains(
24    qq{<a href="http://localhost/site/mysite/schema/dbic/source/$_">},
25    "Tables list page contains a link to $_ table"
26) for qw( album artist copyright track );
27
28my @links = $mech->find_all_links( url_regex => qr/localhost/ );
29$mech->links_ok( [$_], 'Check table link '. $_->url ) for @links;
30
31my $VERSION = $Catalyst::Plugin::AutoCRUD::VERSION;
32foreach (qw( album artist copyright track )) {
33    $mech->get_ok("/site/mysite/schema/dbic/source/$_", "Get autocrud for $_ table");
34    $mech->title_is(ucfirst($_) ." List - Powered by CPAC v$VERSION", "Page title for $_");
35}
36
37#warn $mech->content;
38__END__
39