Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c5e7f9d

Browse files
committedFeb 24, 2022
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 jsonapi-rb#135
1 parent 75314ad commit c5e7f9d

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)
Please sign in to comment.