1use strict;
2use Test::More tests => 17;
3use Test::Exception;
4
5use lib "t";
6use TestAppSetup;
7use_ok('Catalyst::Test', 'BookShelf');
8
9
10
11my $html;
12
13diag("Check for links to related tables - list");
14ok($html = get("/book/list"), "GET /book/list ok");
15like($html, qr|/genre/view/5">Fantasy</a>|si, "  Link genre");
16like($html, qr|/genre/view/3">Mystery</a>|si, "  Link genre");
17
18like($html, qr|/borrower/view/1">In Shelf</a>|si, "  Link borrower");
19like($html, qr|/borrower/view/2">Ole Oyvind Hove</a>|si, "  Link borrower");
20
21
22
23diag("Check for links to related tables - view");
24ok($html = get("/book/view/1"), "GET /book/view/1 ok");
25
26like($html, qr|/genre/list">Genre</a>|si, "  Link genre list");
27like($html, qr|/genre/view/5">Fantasy</a>|si, "  Link genre view");
28
29like($html, qr|/borrower/list">Borrower</a>|si, "  Link borrower list");
30like($html, qr|/borrower/view/1">In Shelf</a>|si, "  Link borrower view");
31
32like($html, qr|/format/list">Format</a>|si, "  Link format list");
33like($html, qr|/format/view/1">Paperback</a>|si, "  Link format view");
34
35
36
37diag("Check for links to related tables - edit");
38ok($html = get("/book/edit/1"), "GET /book/edit/1 ok");
39
40like($html, qr|/genre/list">Genre</a>|si, "  Link genre list");
41
42like($html, qr|/borrower/list">Borrower</a>|si, "  Link borrower list");
43
44like($html, qr|/format/list">Format</a>|si, "  Link format list");
45
46
47
48
49__END__
50