Skip to content

Commit

Permalink
Be much more verbose in feed test
Browse files Browse the repository at this point in the history
to try to figure out why it fails on travis.
  • Loading branch information
rwstauner committed Oct 1, 2013
1 parent b0e9607 commit 6c19523
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions t/controller/feed.t
Expand Up @@ -2,18 +2,35 @@ use strict;
use warnings;
use Test::More;
use MetaCPAN::Web::Test;
use Try::Tiny;

my @tests = qw(/feed/recent /feed/author/PERLER /feed/distribution/Moose);

test_psgi app, sub {
my $cb = shift;
foreach my $test (@tests) {
subtest $test => sub {
ok( my $res = $cb->( GET $test), $test );
is( $res->code, 200, 'code 200' );
is( $res->header('content-type'),
'application/rss+xml; charset=UTF-8', 'Content-type is application/rss+xml' );
ok(my $tx = eval { tx($res) }, 'valid xml');

my $tx = valid_xml($res, $test);
};
}
};

done_testing;
sub valid_xml {
my ($res) = @_;
my ($tx, $err);

try { $tx = tx($res) }
catch { $err = $_[0] };

ok( $tx, 'valid xml' );
is($err, undef, 'no errors');

return $tx;
}

done_testing;

0 comments on commit 6c19523

Please sign in to comment.