From c5e7f9d815424bfc6a3df3e78fd33e9efa3babc6 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Tue, 2 Nov 2021 15:54:14 +0100 Subject: [PATCH] Fix spec when timezone is not UTC The previous implementation generated a time object in the time zone of the machine, so the comparison was failing if the time zone was not UTC Fix #135 --- spec/render_jsonapi_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/render_jsonapi_spec.rb b/spec/render_jsonapi_spec.rb index 5f84110..a02c10b 100644 --- a/spec/render_jsonapi_spec.rb +++ b/spec/render_jsonapi_spec.rb @@ -32,7 +32,7 @@ def jsonapi_cache_key(*) end def user - OpenStruct.new(id: 1, name: 'Johnny Cache', dob: Time.new(2021,1,1)) + OpenStruct.new(id: 1, name: 'Johnny Cache', dob: Time.utc(2021,1,1)) end def index @@ -72,7 +72,7 @@ def index_with_caching it 'renders equivalent JSON whether caching or not' do expected_response = { - "data"=>[{"id"=>"1", "type"=>"users", "attributes"=>{"id"=>1, "name"=>"Johnny Cache", "dob"=>"2021-01-01T00:00:00.000+00:00"}}], + "data"=>[{"id"=>"1", "type"=>"users", "attributes"=>{"id"=>1, "name"=>"Johnny Cache", "dob"=>"2021-01-01T00:00:00.000Z"}}], "jsonapi"=>{"version"=>"1.0"} }