Skip to content

Failing spec not on GMT #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tagliala opened this issue Nov 2, 2021 · 2 comments · Fixed by #136
Closed

Failing spec not on GMT #135

tagliala opened this issue Nov 2, 2021 · 2 comments · Fixed by #136

Comments

@tagliala
Copy link
Contributor

tagliala commented Nov 2, 2021

How to reproduce

  1. Clone the repo
  2. Set the machine on a different time zone than GMT
  3. bundle
  4. rake
Failures:

  1) ActionController::Base#render when using a cache renders equivalent JSON whether caching or not
     Failure/Error: expect(response_with_no_caching).to eq expected_response
     
       expected: {"data"=>[{"attributes"=>{"dob"=>"2021-01-01T00:00:00.000+00:00", "id"=>1, "name"=>"Johnny Cache"}, "id"=>"1", "type"=>"users"}], "jsonapi"=>{"version"=>"1.0"}}
            got: {"data"=>[{"attributes"=>{"dob"=>"2021-01-01T00:00:00.000+01:00", "id"=>1, "name"=>"Johnny Cache"}, "id"=>"1", "type"=>"users"}], "jsonapi"=>{"version"=>"1.0"}}
     
       (compared using ==)
     
       Diff:
       @@ -1 +1 @@
       -"data" => [{"attributes"=>{"dob"=>"2021-01-01T00:00:00.000+00:00", "id"=>1, "name"=>"Johnny Cache"}, "id"=>"1", "type"=>"users"}],
       +"data" => [{"attributes"=>{"dob"=>"2021-01-01T00:00:00.000+01:00", "id"=>1, "name"=>"Johnny Cache"}, "id"=>"1", "type"=>"users"}],
       
     # ./spec/render_jsonapi_spec.rb:85:in `block (3 levels) in <top (required)>'

The difference is in the time zone, I'm on GMT + 1

tagliala added a commit to tagliala/jsonapi-rails that referenced this issue Nov 2, 2021
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
@remear
Copy link
Member

remear commented Feb 24, 2022

@tagliala Would you be able to confirm whether #133 fixed this?

tagliala added a commit to tagliala/jsonapi-rails that referenced this issue Feb 24, 2022
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
@tagliala
Copy link
Contributor Author

Hi @remear , unfortunately it doesn't

$ git rev-parse HEAD
75314ad9742e8fe4746e1c8418779d2aacf7d9b8

$ rspec ./spec/render_jsonapi_spec.rb:73 
Run options: include {:locations=>{"./spec/render_jsonapi_spec.rb"=>[73]}}
I, [2022-02-24T10:20:52.021478 #22924]  INFO -- : Completed JSON API rendering (0.36ms)
I, [2022-02-24T10:20:52.029168 #22924]  INFO -- : Completed JSON API rendering (0.49ms)
F

Failures:

  1) ActionController::Base#render when using a cache renders equivalent JSON whether caching or not
     Failure/Error: expect(response_with_no_caching).to eq expected_response
     
       expected: {"data"=>[{"attributes"=>{"dob"=>"2021-01-01T00:00:00.000+00:00", "id"=>1, "name"=>"Johnny Cache"}, "id"=>"1", "type"=>"users"}], "jsonapi"=>{"version"=>"1.0"}}
            got: {"data"=>[{"attributes"=>{"dob"=>"2021-01-01T00:00:00.000+01:00", "id"=>1, "name"=>"Johnny Cache"}, "id"=>"1", "type"=>"users"}], "jsonapi"=>{"version"=>"1.0"}}
     
       (compared using ==)
     
       Diff:
       @@ -1 +1 @@
       -"data" => [{"attributes"=>{"dob"=>"2021-01-01T00:00:00.000+00:00", "id"=>1, "name"=>"Johnny Cache"}, "id"=>"1", "type"=>"users"}],
       +"data" => [{"attributes"=>{"dob"=>"2021-01-01T00:00:00.000+01:00", "id"=>1, "name"=>"Johnny Cache"}, "id"=>"1", "type"=>"users"}],
       
     # ./spec/render_jsonapi_spec.rb:85:in `block (3 levels) in <top (required)>'

Finished in 0.03709 seconds (files took 1.28 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/render_jsonapi_spec.rb:73 # ActionController::Base#render when using a cache renders equivalent JSON whether caching or not

I've rebased and push-forced by PR

remear pushed a commit that referenced this issue Jun 25, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants