Skip to content
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

Error: wrong number of arguments (given 1, expected 4) for Ruby 3.2 #2768

Open
abratashov opened this issue Dec 23, 2024 · 0 comments
Open

Comments

@abratashov
Copy link

abratashov commented Dec 23, 2024

After upgrading from Ruby 3.1 to 3.2 tests are failing with this error:

$ rspec 

Failure/Error: news.image = File.open(Rails.root.join('spec/fixtures/files/slider.png').to_s)
     
ArgumentError:
  wrong number of arguments (given 1, expected 4)
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/processing/mini_magick.rb:233:in `crop'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/processing.rb:111:in `block (2 levels) in process!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/processing.rb:88:in `each'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/processing.rb:88:in `block in process!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/callbacks.rb:15:in `with_callbacks'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/processing.rb:87:in `process!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/bundler/gems/carrierwave_backgrounder-fbb13e2b658c/lib/backgrounder/delay.rb:14:in `process!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/callbacks.rb:14:in `block in with_callbacks'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/callbacks.rb:14:in `each'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/callbacks.rb:14:in `with_callbacks'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/cache.rb:146:in `cache!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/versions.rb:236:in `cache!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/versions.rb:331:in `block in cache_versions!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/versions.rb:331:in `each_value'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/versions.rb:331:in `cache_versions!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/bundler/gems/carrierwave_backgrounder-fbb13e2b658c/lib/backgrounder/delay.rb:6:in `cache_versions!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/callbacks.rb:16:in `block in with_callbacks'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/callbacks.rb:16:in `each'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/callbacks.rb:16:in `with_callbacks'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/cache.rb:146:in `cache!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/uploader/versions.rb:236:in `cache!'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/mounter.rb:94:in `block (2 levels) in cache'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/mounter.rb:230:in `handle_error'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/mounter.rb:78:in `block in cache'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/mounter.rb:77:in `map'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/mounter.rb:77:in `cache'
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-3.1.0/lib/carrierwave/mount.rb:146:in `image='
# /home/user/.rvm/gems/ruby-3.2.6@my_project/gems/carrierwave-base64-2.11.0/lib/carrierwave/base64/mounting_helper.rb:53:in `block in define_writer'
# ./spec/factories/news.rb:19:in `block (3 levels) in <top (required)>'

Possible solution in line https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/processing/mini_magick.rb#L238:

# lib/carrierwave/processing/mini_magick.rb#L238

    def crop(left, top, width, height, combine_options: {}, &block)
      width, height = resolve_dimensions(width, height)

      minimagick!(block) do |builder|
        builder.crop(left, top, width, height)
          .apply(**combine_options) # instead of '.apply(combine_options)'
      end
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

No branches or pull requests

1 participant