From: Dan Brook Date: Thu, 6 May 2010 22:20:47 +0000 (+0100) Subject: Fixed failing Content-Type tests. X-Git-Tag: 0.002002~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FGitalist.git;a=commitdiff_plain;h=4dacb4b2dd8b8054fea25101eec329fe5f4a9de2 Fixed failing Content-Type tests. * Fixed bare repo bug where we were trying to build references that didn't exist. * Fixed bug where HTML entities were creeping into the atom feed. --- diff --git a/lib/Gitalist/Controller/Root.pm b/lib/Gitalist/Controller/Root.pm index 4bbda7f..eb6a147 100644 --- a/lib/Gitalist/Controller/Root.pm +++ b/lib/Gitalist/Controller/Root.pm @@ -79,8 +79,12 @@ sub error_404 : Action { __PACKAGE__->config( default => 'text/html', map => { - 'text/html' => [qw/ View Default /], 'application/json' => [qw/ JSON /], + map { $_ => [qw/ View Default /] } + qw( text/css text/html text/plain + application/atom+xml application/rss+xml + application/rss application/xml ) + } ); diff --git a/lib/Gitalist/Git/Repository.pm b/lib/Gitalist/Git/Repository.pm index 69c9051..74de771 100644 --- a/lib/Gitalist/Git/Repository.pm +++ b/lib/Gitalist/Git/Repository.pm @@ -74,7 +74,7 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils { lazy_build => 1 ); method BUILD { - $self->$_() for qw/last_change owner description references/; # Ensure to build early. + $self->$_() for qw/last_change owner description /; # Ensure to build early. } ## Public methods diff --git a/root/repository/atom.tt2 b/root/repository/atom.tt2 index 9f721ab..b3b2482 100644 --- a/root/repository/atom.tt2 +++ b/root/repository/atom.tt2 @@ -4,7 +4,7 @@ [% updated %] [% FOREACH Commit = Commits %] - [% Commit.title | html_entity %] + [% Commit.title | xml %] [% Commit.id %] diff --git a/t/atom.t b/t/atom.t index d4de77d..bb50e26 100644 --- a/t/atom.t +++ b/t/atom.t @@ -3,8 +3,9 @@ use FindBin qw/$Bin/; BEGIN { do "$FindBin::Bin/../script/env" or die $@ } use lib "$Bin/lib"; use TestGitalist; +use HTTP::Request::Common; -my $res = request('/repo1/atom'); +my $res = request(GET 'http://localhost/repo1/atom', 'Content-Type' => 'application/atom+xml'); ok $res->is_success; is $res->content_type, 'application/atom+xml'; TODO: { diff --git a/t/json_view.t b/t/json_view.t index b32a0a6..b4d683e 100644 --- a/t/json_view.t +++ b/t/json_view.t @@ -28,15 +28,6 @@ is_deeply $data, { 'is_bare' => 1, '__CLASS__' => 'Gitalist::Git::Repository', 'last_change' => '2009-11-12T19:00:34Z', - 'references' => { - '0710a7c8ee11c73e8098d08f9384c2a839c65e4e' => [ - 'heads/branch1' - ], - '36c6c6708b8360d7023e8a1649c45bcf9b3bd818' => [ - 'heads/master', - 'tags/0.01' - ] - }, 'name' => 'repo1', 'description' => 'some test repository' }; diff --git a/t/opml.t b/t/opml.t index b5bb93c..642e709 100644 --- a/t/opml.t +++ b/t/opml.t @@ -3,8 +3,10 @@ use FindBin qw/$Bin/; BEGIN { do "$FindBin::Bin/../script/env" or die $@ } use lib "$Bin/lib"; use TestGitalist; +use HTTP::Request::Common; + +my $res = request(GET 'http://localhost/opml', 'Content-Type' => 'application/rss'); -my $res = request('/opml'); ok $res->is_success; is $res->content_type, 'application/rss'; diff --git a/t/rss.t b/t/rss.t index c9c3804..ee72240 100644 --- a/t/rss.t +++ b/t/rss.t @@ -3,8 +3,9 @@ use FindBin qw/$Bin/; BEGIN { do "$FindBin::Bin/../script/env" or die $@ } use lib "$Bin/lib"; use TestGitalist; +use HTTP::Request::Common; -my $res = request('/repo1/rss'); +my $res = request(GET 'http://localhost/repo1/rss', 'Content-Type' => 'application/rss+xml'); ok $res->is_success; is $res->content_type, 'application/rss+xml'; like $res->content, qr{link>http://localhost/repo1