From: Dan Brook Date: Sat, 26 Feb 2011 15:44:57 +0000 (+0000) Subject: Fix app-mech-rootpage.t test. X-Git-Tag: 0.002008~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FGitalist.git;a=commitdiff_plain;h=3dddff362db510a3ba852489b74a80227f74b497 Fix app-mech-rootpage.t test. This was broken as of the Foxtons redesign as I forgot to update the tests. With the odd tweak here and there it passes again. If I ever find the tuits I'd like to have this test for the rest of the actions. --- diff --git a/root/fragment/collectionofrepositories.tt2 b/root/fragment/collectionofrepositories.tt2 index 2bd62c5..b053ea8 100755 --- a/root/fragment/collectionofrepositories.tt2 +++ b/root/fragment/collectionofrepositories.tt2 @@ -1,7 +1,7 @@ [% FOR p IN repositories %] [%- repos_link = c.uri_for_action('/repository/summary', [p.name]) -%] - + [% loop.count %] [% p.name %]
[% abridged_description(p.description) IF p.description != "Unnamed repository; edit this file to name it for gitweb." %]
diff --git a/t/app-mech-rootpage.t b/t/app-mech-rootpage.t index 0bba4f4..a2b2e46 100644 --- a/t/app-mech-rootpage.t +++ b/t/app-mech-rootpage.t @@ -13,27 +13,23 @@ plan 'skip_all' => "One or more of the following modules aren't present: Test::W MECH->get_ok('/'); { - my $nodeset = MECH->findnodes('/html/body//tr[@class="reposrow"]'); + my $nodeset = MECH->findnodes('/html/body//tr[@class="repository"]'); foreach my $row ($nodeset->get_nodelist) { my $uri = $row->findnodes('.//a')->[0]->attr('href'); - my ($repos_name) = $uri =~ m{^http://localhost/([\w\.]+)$}; + my ($repos_name) = $uri =~ m{^http://localhost/([\w\.]+)}; ok $repos_name, "Repos name $repos_name"; like $row->findnodes('.//a')->[1]->as_text, qr{^[\w\s/;',\.]+$}, 'Have description' unless $repos_name eq 'nodescription'; - like $row->findnodes('.//td[@class="time-since"')->[0]->as_text, qr/^(never|\d\s+(years|months)\s+ago)$/, + like $row->findnodes('.//td[@class="time-since"')->[0]->as_text, qr/^(never|\d+\s+(years|months)\s+ago)$/, 'Last change looks ok'; - my ($summary, $shortlog, $log, $tree) = $row->findnodes('.//td[@class="link"]/a')->get_nodelist; - like $summary->as_text, qr/summary/i, 'summary text ok'; - is $summary->attr('href'), $uri, 'summary href correct'; - like $shortlog->as_text, qr/shortlog/i, 'shortlog text ok'; + my ($shortlog, $log, $tree) = $row->findnodes('.//td[@class="action-list"]/a')->get_nodelist; + $uri =~ s{/summary}{}; + like $shortlog->as_text, qr/short log/i, 'shortlog text ok'; is $shortlog->attr('href'), "$uri/shortlog", 'shortlog href ok'; like $log->as_text, qr/log/, 'log text ok'; is $log->attr('href'), "$uri/log", 'log href ok'; like $tree->as_text, qr/tree/, 'tree text ok'; - TODO: { - local $TODO = 'Bork'; - is $tree->attr('href'), "$uri/tree", 'tree href ok'; - } + is $tree->attr('href'), "$uri/HEAD/tree", 'tree href ok'; } }