Skip to content

Commit

Permalink
All tests successful.
Browse files Browse the repository at this point in the history
  • Loading branch information
monken committed Jan 27, 2014
1 parent 007e721 commit d338687
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 77 deletions.
2 changes: 1 addition & 1 deletion root/inc/dependencies.html
Expand Up @@ -18,5 +18,5 @@
<%- END %>
<li class="divider"></li>
<li><a href="http://deps.cpantesters.org/?module=<% release.distribution.replace('-', '::') %>"><i class="icon-retweet"></i> CPAN Testers List</a></li>
<li><a href="/requires/module/<% release.distribution %>?sort=[[2,1]]"><i class="icon-share-alt"></i> Reverse dependencies</a></li>
<li><a href="/requires/distribution/<% release.distribution %>?sort=[[2,1]]"><i class="icon-share-alt"></i> Reverse dependencies</a></li>
</ul>
6 changes: 3 additions & 3 deletions root/inc/favorite.html
Expand Up @@ -4,8 +4,8 @@
<input type="hidden" name="release" value="<% module.release || module.name %>">
<input type="hidden" name="author" value="<% module.author %>">
<input type="hidden" name="distribution" value="<% module.distribution %>">
<button type="submit" class="favorite<% IF module.favorites %> highlight<% END %><% IF module.myfavorite %> active<% END %>"><span><% module.favorites %></span> ++</button>
<button type="submit" class="favorite<% IF module.favorites || release.favorites %> highlight<% END %><% IF module.myfavorite %> active<% END %>"><span><% module.favorites || release.favorites %></span> ++</button>
</form>
<% ELSE -%>
<a href="" onclick="alert('Please sign in to add favorites'); return false" class="favorite<% IF module.favorites %> highlight<% END %>"><span>
<% module.favorites %></span> ++</a><% END -%>
<a href="" onclick="alert('Please sign in to add favorites'); return false" class="favorite<% IF module.favorites || release.favorites %> highlight<% END %>"><span>
<% module.favorites || release.favorites %></span> ++</a><% END -%>
2 changes: 1 addition & 1 deletion root/inc/rating.html
@@ -1,2 +1,2 @@
<div class="rating-<% (rating.mean * 2).fmt('%.0f') / 2 * 10 %>"></div>
<a href="http://cpanratings.perl.org/rate/?distribution=<% distribution %>" class="rating-<% (rating.mean * 2).fmt('%.0f') / 2 * 10 %>"></a>
(<a href="http://cpanratings.perl.org/dist/<% distribution %>"><% rating.count %> review<% IF rating.count > 1; 's'; END %></a>)
2 changes: 1 addition & 1 deletion root/pod.html
Expand Up @@ -35,7 +35,7 @@
<% INCLUDE inc/dependencies.html dependencies = release.dependency %>
<% IF req.cookies.hideTOC.value %><style>#index { display:none}</style><% END %>
<a name="___pod"></a>
<div class="pod">
<div class="pod content">
<% IF pod %>
<% pod.replace(/<pre><code>/, '<pre class="brush: pl; class-name: \'highlight\'; toolbar: false; gutter: false; metacpan-verbatim">').replace(/<\/code><\/pre>/, '</pre>') | none %>
<% ELSE %>
Expand Down
9 changes: 5 additions & 4 deletions t/controller/pod.t
Expand Up @@ -20,19 +20,20 @@ test_psgi app, sub {
my $latest = $res->content;
ok( $res = $cb->( GET $this ), "GET $this" );
my $tx2 = tx($res);
ok($tx->find_value('//div[contains(@class, "content")]'),
"page has content");
is(
$tx2->find_value( '//div[@id="content"]'),
$tx->find_value('//div[@id="content"]'),
$tx2->find_value( '//div[contains(@class, "content")]'),
$tx->find_value('//div[contains(@class, "content")]'),
'content of both urls is exactly the same'
);

like $tx->find_value('//div[@class="pod"]//pre/@class'),
like $tx->find_value('//div[contains(@class, "pod")]//pre/@class'),
qr/^brush: pl; .+; metacpan-verbatim$/,
'verbatim pre tag has syn-hi class';

# Request with lowercase author redirects to uppercase author.
$this =~ s{(/pod/release/)([^/]+)}{$1\L$2}; # lc author name
warn $this;
ok( $res = $cb->( GET $this ), "GET $this" );
is( $res->code, 301, 'code 301' );
};
Expand Down
2 changes: 1 addition & 1 deletion t/controller/search.t
Expand Up @@ -33,7 +33,7 @@ test_psgi app, sub {

# Moose has ratings (other things on this search page likely do as well)
$tx->like(
'//div[@class="search-results"]//div[starts-with(@class, "rating-")]/following-sibling::a',
'//div[@class="search-results"]//a[starts-with(@class, "rating-")]/following-sibling::a',
qr/\d+ reviews?/i,
'current rating and number of reviews listed'
);
Expand Down
78 changes: 12 additions & 66 deletions t/controller/shared/release-info.t
Expand Up @@ -103,7 +103,7 @@ test_psgi app, sub {

optional_test favorited => sub {
ok( $tx->find_value("$favs/span") > 0,
'dist has been marked as favorite'
"$req_uri has been marked as favorite"
);
};

Expand Down Expand Up @@ -132,7 +132,7 @@ test_psgi app, sub {

# not all dists have reviews
my $reviews
= '//div[@class="search-bar"]//div[starts-with(@class, "rating-")]/following-sibling::a';
= '//a[starts-with(@class, "rating-")]/following-sibling::a';
optional_test reviews => sub {
$tx->is(
"$reviews/\@href",
Expand All @@ -147,15 +147,14 @@ test_psgi app, sub {
};

# all dists should get a link to rate it; test built url
$tx->is(
'//div[@class="search-bar"]//a[text()="Rate this distribution"]/@href',
"http://cpanratings.perl.org/rate/?distribution=$release",
ok( $tx->find_value(
'//a[@href="http://cpanratings.perl.org/rate/?distribution=' . $release . '"]'),
'cpanratings link to rate this dist'
);

# test format of cpantesters link
$tx->is(
'//a[text()="Test results"]/@href',
'//a[text()="Testers"]/@href',
"http://www.cpantesters.org/distro/$first_letter/$release.html#$release-$version?oncpan=1&distmat=1",
'link to test results'
);
Expand All @@ -170,7 +169,7 @@ test_psgi app, sub {

# version select box
ok( $tx->find_value(
'//select[@name="release"]/option[text()="Go to version"]'
'//div[@class="breadcrumbs"]//select'
),
'version select box'
);
Expand All @@ -187,67 +186,14 @@ test_psgi app, sub {
# TODO: search
# TODO: toggle table of contents (module only)

# not all dists have reviews
my $reviews = '//div[@class="nav-list"]//div[starts-with(@class, "rating-")]/following-sibling::a';
optional_test reviews => sub {
$tx->is(
"$reviews/\@href",
"http://cpanratings.perl.org/dist/$release",
'link to current reviews'
);
$tx->like(
'//a[text()="Reverse dependencies"]/@href',
qr{^/requires/distribution/$release(\?|$)},
ok( $tx->find_value(
'//a[starts-with(@href, "/requires/distribution/")]'),
'reverse deps link uses dist name'
);
};

# all dists should get a link to rate it; test built url
$tx->is(
'//div[@class="nav-list"]//a[text()="Rate this distribution"]/@href',
"http://cpanratings.perl.org/rate/?distribution=$release",
'cpanratings link to rate this dist'
);

# test format of cpantesters link
$tx->is(
'//a[text()="Test results"]/@href',
"http://www.cpantesters.org/distro/$first_letter/$release.html#$release-$version?oncpan=1&distmat=1",
'link to test results'
);

# TODO: release.tests.size

$tx->is(
'//a[@title="Matrix"]/@href',
"http://matrix.cpantesters.org/?dist=$release+$version",
'link to test matrix'
);

# version select box
ok( $tx->find_value('//select[@name="release"]/option[text()="Go to version"]'),
'version select box' );

$tx->like(
# "go to" option has no value attr
'//select[@name="release"]/option[@value][1]',
qr/\([A-Z]{3,9} on \d{4}-\d{2}-\d{2}\)$/,
'version ends with pause id and date in common format'
);

# TODO: diff with version
# TODO: search
# TODO: toggle table of contents (module only)

$tx->like(
'//a[text()="Reverse dependencies"]/@href',
qr{^/requires/distribution/$release(\?|$)},
'reverse deps link uses dist name'
);

# TODO: explorer
# TODO: activity

# TODO: explorer
# TODO: activity
}
}

ok( $tested{$_} > 0, "at least one module tested $_" )
Expand All @@ -265,4 +211,4 @@ sub optional_test {
$sub->();
++$tested{$name};
};
}
}

0 comments on commit d338687

Please sign in to comment.