Fix for infinite loop bug in blame.
[catagits/Gitalist.git] / t / json_view.t
CommitLineData
1aae440e 1#!/usr/bin/env perl
2
3use FindBin qw/$Bin/;
4BEGIN {
5 my $env = "$FindBin::Bin/../script/env";
6 if (-r $env) {
7 do $env or die $@;
8 }
9}
10
11use strict;
12use warnings;
13use Test::More;
14use HTTP::Request::Common;
15use JSON::XS qw/decode_json encode_json/;
16
17BEGIN {
18 $ENV{GITALIST_CONFIG} = $Bin;
19 $ENV{GITALIST_REPO_DIR} = '';
20 use_ok 'Catalyst::Test', 'Gitalist';
21}
22
23my $res = request(GET 'http://localhost/repo1', 'Content-Type' => 'application/json');
24is $res->code, 200;
25my $data = decode_json $res->content;
26is ref($data), 'HASH';
27delete $data->{owner}
28 if $data && exists $data->{owner};
29is_deeply $data, {
30 'is_bare' => 1,
31 '__CLASS__' => 'Gitalist::Git::Repository',
09717a40 32 'last_change' => '2011-06-05T23:00:44Z',
1aae440e 33 'name' => 'repo1',
34 'description' => 'some test repository'
35 };
36
37done_testing;
38
39