Subject: | Failing tests, t/rest/item.t t/rest/list.t due to breaking changes in JSON.pm |
As of JSON 2.9, JSON no longer overloads eq. Therefore JSON::true ne 'true'
The tests relied on overload of eq in JSON to check for "true" when json were in use.
Proposed fix in tests, check for JSON::true instead of eq 'true'.
Patch is attached.
Subject: | Catalyst-Controller-API-Rest.patch |
diff --git a/t/rest/item.t b/t/rest/item.t
index dea2b88..a2a50dd 100644
--- a/t/rest/item.t
+++ b/t/rest/item.t
@@ -29,6 +29,7 @@ my $artist_view_url = "$base/api/rest/artist/";
my %expected_response =
$schema->resultset('Artist')->find($id)->get_columns;
my $response = $json->decode( $mech->content );
+ #artist does not have use_json_boolean => 1, so true values are stringified to 'true'
is_deeply(
$response,
{ data => \%expected_response, success => 'true' },
@@ -65,7 +66,7 @@ my $track_view_url = "$base/api/rest/track/";
my $response = $json->decode( $mech->content );
is_deeply(
$response,
- { data => \%expected_response, success => 'true' },
+ { data => \%expected_response, success => JSON::true },
'correct data returned for track with datetime'
);
}
diff --git a/t/rest/list.t b/t/rest/list.t
index 3afd448..7337531 100644
--- a/t/rest/list.t
+++ b/t/rest/list.t
@@ -203,7 +203,7 @@ my $track_list_url = "$base/api/rest/track";
} $schema->resultset('Track')->search( undef, { page => 1, } )->all;
is_deeply(
$response,
- { list => \@expected_response, success => 'true', totalcount => 15 },
+ { list => \@expected_response, success => JSON::true, totalcount => 15 },
'correct data returned for static configured paging'
);
}