This repository has been archived by the owner on Mar 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Ruby 3 compatibility #104
Comments
Merged
julik
pushed a commit
that referenced
this issue
Jan 9, 2021
✅ Locally, for Ruby <= 2.7.2 specs are all passing ❌ For Ruby 3.0 some specs are failing. All errors seem to be related to the changed behavior for kwargs -> **update**: see comments below! ``` Finished in 19.31 seconds (files took 0.67243 seconds to load) 123 examples, 7 failures Failed examples: rspec ./spec/zip_tricks/block_deflate_spec.rb:46 # ZipTricks::BlockDeflate deflate_in_blocks_and_terminate uses deflate_in_blocks rspec ./spec/zip_tricks/block_deflate_spec.rb:58 # ZipTricks::BlockDeflate deflate_in_blocks_and_terminate passes a custom compression level rspec ./spec/zip_tricks/block_deflate_spec.rb:87 # ZipTricks::BlockDeflate.deflate_in_blocks honors the block size rspec ./spec/zip_tricks/rails_streaming_spec.rb:4 # ZipTricks::RailsStreaming calls the requisite controller methods rspec ./spec/zip_tricks/streamer_spec.rb:276 # ZipTricks::Streamer writes the correct archive elements when using data descriptors rspec ./spec/zip_tricks/streamer_spec.rb:420 # ZipTricks::Streamer prevents duplicates in the stored files rspec ./spec/zip_tricks/streamer_spec.rb:525 # ZipTricks::Streamer writes the specified modification time ``` -> I've added a new issue to address the actual fixes for Ruby 3 in a separated PR: #104 **update** the actual problem (for the first spec at least) is `rspec-mocks`, in particular this line: https://github.com/rspec/rspec-mocks/blob/6ab343ca479c606e892c82ce0245e7410e3f0eac/lib/rspec/mocks/message_expectation.rb#L101 ```ruby def and_call_original wrap_original(__method__) do |original, *args, &block| original.call(*args, &block) end end ``` which will receive the following `args`: ```ruby [#<StringIO:0x00007ff8d713bfc8>, #<StringIO:0x00007ff8d713be88>, {:level=>-1, :block_size=>65536}] ``` hence this is expanded to 3 params, 2x a string, and a hash, which is then not splatted into kwargs. Further research shows, there is already an Issue: rspec/rspec-mocks#1306 with a fixing PR: rspec/rspec-mocks#1324
I have merged #103 thank you for doing this work! We do not have ruby 3 in production anywhere so it is very valuable. Can you pick this up once |
rspec-mocks is updated now (details: rspec/rspec-mocks#1396), basically we'll need to use |
julik
pushed a commit
to julik/zip_kit
that referenced
this issue
Feb 29, 2024
✅ Locally, for Ruby <= 2.7.2 specs are all passing ❌ For Ruby 3.0 some specs are failing. All errors seem to be related to the changed behavior for kwargs -> **update**: see comments below! ``` Finished in 19.31 seconds (files took 0.67243 seconds to load) 123 examples, 7 failures Failed examples: rspec ./spec/zip_tricks/block_deflate_spec.rb:46 # ZipTricks::BlockDeflate deflate_in_blocks_and_terminate uses deflate_in_blocks rspec ./spec/zip_tricks/block_deflate_spec.rb:58 # ZipTricks::BlockDeflate deflate_in_blocks_and_terminate passes a custom compression level rspec ./spec/zip_tricks/block_deflate_spec.rb:87 # ZipTricks::BlockDeflate.deflate_in_blocks honors the block size rspec ./spec/zip_tricks/rails_streaming_spec.rb:4 # ZipTricks::RailsStreaming calls the requisite controller methods rspec ./spec/zip_tricks/streamer_spec.rb:276 # ZipTricks::Streamer writes the correct archive elements when using data descriptors rspec ./spec/zip_tricks/streamer_spec.rb:420 # ZipTricks::Streamer prevents duplicates in the stored files rspec ./spec/zip_tricks/streamer_spec.rb:525 # ZipTricks::Streamer writes the specified modification time ``` -> I've added a new issue to address the actual fixes for Ruby 3 in a separated PR: WeTransfer/zip_tricks#104 **update** the actual problem (for the first spec at least) is `rspec-mocks`, in particular this line: https://github.com/rspec/rspec-mocks/blob/6ab343ca479c606e892c82ce0245e7410e3f0eac/lib/rspec/mocks/message_expectation.rb#L101 ```ruby def and_call_original wrap_original(__method__) do |original, *args, &block| original.call(*args, &block) end end ``` which will receive the following `args`: ```ruby [#<StringIO:0x00007ff8d713bfc8>, #<StringIO:0x00007ff8d713be88>, {:level=>-1, :block_size=>65536}] ``` hence this is expanded to 3 params, 2x a string, and a hash, which is then not splatted into kwargs. Further research shows, there is already an Issue: rspec/rspec-mocks#1306 with a fixing PR: rspec/rspec-mocks#1324
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently, specs are failing under Ruby 3, see: #103
We should address these issues, i.e. update the syntax to be compatible with Ruby 3.
The text was updated successfully, but these errors were encountered: