Skip to content

Commit 1c17b46

Browse files
committed
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
1 parent 163f371 commit 1c17b46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spec/render_jsonapi_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def jsonapi_cache_key(*)
3232
end
3333

3434
def user
35-
OpenStruct.new(id: 1, name: 'Johnny Cache', dob: Time.new(2021,1,1))
35+
OpenStruct.new(id: 1, name: 'Johnny Cache', dob: Time.utc(2021,1,1))
3636
end
3737

3838
def index
@@ -72,7 +72,7 @@ def index_with_caching
7272

7373
it 'renders equivalent JSON whether caching or not' do
7474
expected_response = {
75-
"data"=>[{"id"=>"1", "type"=>"users", "attributes"=>{"id"=>1, "name"=>"Johnny Cache", "dob"=>"2021-01-01T00:00:00.000+00:00"}}],
75+
"data"=>[{"id"=>"1", "type"=>"users", "attributes"=>{"id"=>1, "name"=>"Johnny Cache", "dob"=>"2021-01-01T00:00:00.000Z"}}],
7676
"jsonapi"=>{"version"=>"1.0"}
7777
}
7878

0 commit comments

Comments
 (0)