use Dist::Zilla::PluginBundle::Git
[catagits/Catalyst-Controller-DBIC-API.git] / t / rest / item.t
index a2a50dd..845bc1a 100644 (file)
@@ -11,9 +11,9 @@ use URI;
 use Test::More;
 use Test::WWW::Mechanize::Catalyst 'RestTest';
 use HTTP::Request::Common;
-use JSON;
+use JSON::MaybeXS;
 
-my $json = JSON->new->utf8;
+my $json = JSON::MaybeXS->new(utf8 => 1);
 
 my $mech = Test::WWW::Mechanize::Catalyst->new;
 ok( my $schema = DBICTest->init_schema(), 'got schema' );
@@ -32,6 +32,8 @@ my $artist_view_url = "$base/api/rest/artist/";
     #artist does not have use_json_boolean => 1, so true values are stringified to 'true'
     is_deeply(
         $response,
+
+        # artist doesn't set use_json_boolean
         { data => \%expected_response, success => 'true' },
         'correct data returned'
     );
@@ -66,7 +68,9 @@ my $track_view_url = "$base/api/rest/track/";
     my $response = $json->decode( $mech->content );
     is_deeply(
         $response,
-        { data => \%expected_response, success => JSON::true },
+
+        # track does set use_json_boolean
+        { data => \%expected_response, success => JSON::MaybeXS::true },
         'correct data returned for track with datetime'
     );
 }
@@ -79,6 +83,8 @@ my $track_view_url = "$base/api/rest/track/";
     my $response = $json->decode( $mech->content );
     is_deeply(
         $response,
+
+        # artist doesn't set use_json_boolean
         { success => 'false' },
         'correct data returned'
     );