Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

adds ruby 3 to CI #103

Merged
merged 3 commits into from
Jan 9, 2021
Merged

adds ruby 3 to CI #103

merged 3 commits into from
Jan 9, 2021

Conversation

swiknaba
Copy link
Contributor

@swiknaba swiknaba commented Jan 5, 2021

  • adds Ruby 3.0 to the CI script
  • git ignore .ruby-version (so I can run specs locally against multiple Ruby versions)

✅  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

      def and_call_original
        wrap_original(__method__) do |original, *args, &block|
          original.call(*args, &block)
        end
      end

which will receive the following args:

[#<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

@swiknaba swiknaba mentioned this pull request Jan 5, 2021
@julik
Copy link
Contributor

julik commented Jan 7, 2021

Lovely! Thank you for looking into this. Do I understand correctly that at the moment the library is fully functional we are just having problems with message expectations? If that is the case, then maybe you could mark ruby 3.0 as "allow failures" until rspec-mocks gets updated? Then we can merge this change quicker

@swiknaba
Copy link
Contributor Author

swiknaba commented Jan 8, 2021

Going through all failures with byebug to inspect passed kwargs.

Streamer
✅  spec/zip_tricks/streamer_spec.rb:525
✅  spec/zip_tricks/streamer_spec.rb:420
✅  spec/zip_tricks/streamer_spec.rb:276

Block deflate
✅  spec/zip_tricks/block_deflate_spec.rb:46
✅  spec/zip_tricks/block_deflate_spec.rb:58
✅  spec/zip_tricks/block_deflate_spec.rb:87

-> looks like each failure is indeed just a problem of rspeck-mock's .receive method (kwargs were present correctly inside the respective methods themselves), issue for tracking progress on this: rspec/rspec-mocks#1396

@julik julik merged commit 16d03ef into WeTransfer:main Jan 9, 2021
@swiknaba
Copy link
Contributor Author

Rspec-mocks fixed this issue with 3.10.2, details on rspec/rspec-mocks#1396

julik pushed a commit to julik/zip_kit that referenced this pull request 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#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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants