jsonapi-rb/jsonapi-rails

Failing spec not on GMT

tagliala opened this issue · 2 comments

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 Would you be able to confirm whether #133 fixed this?

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