Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

Update oj to a more up-to-date version #28

Open
paulkoegel opened this issue Apr 14, 2020 · 1 comment
Open

Update oj to a more up-to-date version #28

paulkoegel opened this issue Apr 14, 2020 · 1 comment

Comments

@paulkoegel
Copy link

paulkoegel commented Apr 14, 2020

Problem statement

  • we use transit-json in a large Rails application.
  • like transit-ruby, some of the other gems we use also rely on the oj gem.
  • we could not update some of those gems because they require at least version 3 of oj, which conflicts with transit-ruby's oj requirement ("~> 2.18").

Proposed solution


FYI: Related issue (this has been fixed, specs are green again with oj version 3.10.16, which my fork uses now, leaving only for reference in case someone encounters this issue / it reappears in the future)

  • The latest versions of oj, 3.10.5 and 3.10.6 (there is no 3.10.4), break the specs of transit-json. It looks to me like this might have been caused by this oj change: ohler55/oj@ebfc1ce and spec expectations in transit-ruby would have to be updated to work with the latest versions of oj.
Failures:

  1) JSON exemplars reads what we expect from ../transit-format/examples/0.8/simple/doubles_interesting.json
     Failure/Error: assert { exemplar.expected_value == actual_value }

       Expected (exemplar.expected_value == actual_value), but
       [-3.14159, 3.14159, 400000000000.0, 299800000.0, 6.626e-34            ]
       [-3.14159, 3.14159, 400000000000.0, 299800000.0, 6.626000000000001e-34]
                                                        ^

           exemplar.expected_value is [-3.14159, 3.14159, 400000000000.0, 299800000.0, 6.626e-34]
           exemplar is #<struct Exemplar name="doubles_interesting", expected_value=[-3.14159, 3.14159, 400000000000.0, 299800000.0, 6.626e-34]>
           actual_value is [-3.14159, 3.14159, 400000000000.0, 299800000.0, 6.626000000000001e-34]
     Shared Example Group: "exemplars" called from ./spec/transit/exemplar_spec.rb:146
     # ./spec/transit/exemplar_spec.rb:135:in `block (2 levels) in verify_exemplar'
     # ./spec/transit/exemplar_spec.rb:133:in `open'
     # ./spec/transit/exemplar_spec.rb:133:in `block in verify_exemplar'

  2) JSON-VERBOSE exemplars reads what we expect from ../transit-format/examples/0.8/simple/doubles_interesting.verbose.json
     Failure/Error: assert { exemplar.expected_value == actual_value }

       Expected (exemplar.expected_value == actual_value), but
       [-3.14159, 3.14159, 400000000000.0, 299800000.0, 6.626e-34            ]
       [-3.14159, 3.14159, 400000000000.0, 299800000.0, 6.626000000000001e-34]
                                                        ^

           exemplar.expected_value is [-3.14159, 3.14159, 400000000000.0, 299800000.0, 6.626e-34]
           exemplar is #<struct Exemplar name="doubles_interesting", expected_value=[-3.14159, 3.14159, 400000000000.0, 299800000.0, 6.626e-34]>
           actual_value is [-3.14159, 3.14159, 400000000000.0, 299800000.0, 6.626000000000001e-34]
     Shared Example Group: "exemplars" called from ./spec/transit/exemplar_spec.rb:150
     # ./spec/transit/exemplar_spec.rb:135:in `block (2 levels) in verify_exemplar'
     # ./spec/transit/exemplar_spec.rb:133:in `open'
     # ./spec/transit/exemplar_spec.rb:133:in `block in verify_exemplar'

Finished in 0.58072 seconds (files took 0.52754 seconds to load)
909 examples, 2 failures

Failed examples:

rspec './spec/transit/exemplar_spec.rb[1:23]' # JSON exemplars reads what we expect from ../transit-format/examples/0.8/simple/doubles_interesting.json
rspec './spec/transit/exemplar_spec.rb[2:23]' # JSON-VERBOSE exemplars reads what we expect from ../transit-format/examples/0.8/simple/doubles_interesting.verbose.json
@paulkoegel
Copy link
Author

paulkoegel commented Nov 26, 2020

with oj version 3.10.16 the transit-ruby specs are now green again for me (tested with Ruby version:
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]).
I've updated the issue description accordingly.

semaperepelitsa added a commit to semaperepelitsa/transit-ruby that referenced this issue Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant