Enabled content type css for css files served by template, previous implementation...
[catagits/Gitalist.git] / t / json_view.t
index b4d683e..e5a436c 100644 (file)
@@ -1,14 +1,18 @@
 #!/usr/bin/env perl
 
 use FindBin qw/$Bin/;
-BEGIN { do "$FindBin::Bin/../script/env" or die $@ }
+BEGIN {
+    my $env = "$FindBin::Bin/../script/env";
+    if (-r $env) {
+        do $env or die $@;
+    }
+}
 
 use strict;
 use warnings;
 use Test::More;
 use HTTP::Request::Common;
-use JSON::Any;
-
+use JSON::XS qw/decode_json encode_json/;
 
 BEGIN {
     $ENV{GITALIST_CONFIG} = $Bin;
@@ -16,11 +20,9 @@ BEGIN {
     use_ok 'Catalyst::Test', 'Gitalist';
 }
 
-my $j = JSON::Any->new;
-
 my $res = request(GET 'http://localhost/repo1', 'Content-Type' => 'application/json');
 is $res->code, 200;
-my $data = $j->decode($res->content);
+my $data = decode_json $res->content;
 is ref($data), 'HASH';
 delete $data->{owner}
   if $data && exists $data->{owner};