A manual cherry-picking of f012b0, making use of syn_engines work mostly.
[catagits/Gitalist.git] / t / json_view.t
CommitLineData
5f79e33f 1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More;
5use HTTP::Request::Common;
6use FindBin qw/$Bin/;
7use JSON::Any;
8
9BEGIN {
10 $ENV{GITALIST_CONFIG} = $Bin;
11 $ENV{GITALIST_REPO_DIR} = '';
12 use_ok 'Catalyst::Test', 'Gitalist';
13}
14
15my $j = JSON::Any->new;
16
17my $res = request(GET 'http://localhost/summary?p=repo1', 'Content-Type' => 'application/json');
18is $res->code, 200;
19my $data = $j->decode($res->content);
20is ref($data), 'HASH';
21is_deeply $data, {
22 'owner' => 'Tomas Doran',
23 'is_bare' => 1,
24 '__CLASS__' => 'Gitalist::Git::Repository',
25 'last_change' => '2009-11-12T19:00:34Z',
26 'references' => {
27 '0710a7c8ee11c73e8098d08f9384c2a839c65e4e' => [
28 'heads/branch1'
29 ],
30 '36c6c6708b8360d7023e8a1649c45bcf9b3bd818' => [
31 'heads/master'
32 ]
33 },
34 'name' => 'repo1',
35 'description' => 'some test repository'
36 };
37
38done_testing;
39
40