Permalink
Browse files

Handling the /dist/$DIST/release/$VER/ URLs properly.

Added a Test::WWW::Mechanize::Catalyst test for it and fixed everything.
  • Loading branch information...
1 parent 849d0b4 commit c1eda192379ac0d68bab75490c8fe61bfedd4a5d @shlomif shlomif committed Jul 22, 2009
Showing with 44 additions and 1 deletion.
  1. +1 −0 Makefile.PL
  2. +6 −0 lib/CPANHQ/Controller/Distribution.pm
  3. +1 −0 root/dist/release_show.tt
  4. +1 −1 root/status.tt
  5. +35 −0 t/controller_Status_mech.t
View
@@ -29,6 +29,7 @@ requires 'List::Util';
requires 'parent';
requires 'Rose::HTML::Form';
requires 'YAML::XS';
+test_requires 'Test::WWW::Mechanize::Catalyst';
# for twitter feed
requires 'XML::RSS';
@@ -85,6 +85,12 @@ sub release : Chained('instance') :PathPart('release') :CaptureArgs(1) {
return;
}
+sub release_show :Chained('release') :PathPart('') :Args(0) {
+ my ($self, $c) = @_;
+
+ return;
+}
+
sub graph :Chained('release') :PathPart("graph.png") :Args(0) {
my ($self, $c) = @_;
@@ -0,0 +1 @@
+[% PROCESS "dist/show.tt" %]
View
@@ -5,4 +5,4 @@
<li>View a list of <a href="[% c.uri_for( '/recent' ) %]">recent uploads</a></li>
<li><a href="[% c.uri_for( '/author/BRICAS' ) %]">Author page</a> started</li>
<li><a href="[% c.uri_for( '/dist/Image-TextMode' ) %]">Distribution page</a> started</li>
-<li><a href="[% c.uri_for( '/dist/Image-TextMode/0.05' ) %]">Specific version of a release</a> is also available</li>
+<li><a href="[% c.uri_for( '/dist/Image-TextMode/release/0.05' ) %]">Specific version of a release</a> is also available</li>
View
@@ -0,0 +1,35 @@
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+use Test::WWW::Mechanize::Catalyst 'CPANHQ';
+
+{
+ my $mech = Test::WWW::Mechanize::Catalyst->new;
+
+ # TEST
+ $mech->get_ok("http://localhost/status/");
+
+ # TEST
+ $mech->follow_link_ok(
+ {
+ text_regex => qr{Specific version of a release},
+ },
+ "Following the link to the release works."
+ );
+}
+
+=head1 AUTHOR
+
+Shlomi Fish L<http://www.shlomifish.org/> .
+
+=head1 LICENSE
+
+This module is free software, available under the MIT X11 Licence:
+
+L<http://www.opensource.org/licenses/mit-license.php>
+
+Copyright by Shlomi Fish, 2009.
+
+=cut
+

0 comments on commit c1eda19

Please sign in to comment.