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

Fix kwargs vs options hash for Ruby 3.0 compatibility #116

Merged
merged 1 commit into from
Jul 20, 2023

Conversation

jasonpenny
Copy link

This updates spec files for Ruby 3.0 compatibility where kwargs are expected in the tests, but an options hash is passed.

On the master branch:

$ rbenv shell 3.0.6
$ BUNDLE_GEMFILE=gemfiles/6.1.gemfile bundle install
$ BUNDLE_GEMFILE=gemfiles/6.1.gemfile bundle exec rake spec
...

Failures:

  1) Paperclip::UriAdapter#download_content with custom read_timeout calls open with read_timeout option
     Failure/Error:
       expect(@uri_opener)
         .to receive(:open).with(@uri, read_timeout: 120).at_least(1).times

       URI received :open with unexpected arguments
         expected: (#<URI::HTTPS https://github.com/thoughtbot/paper:clip.jpg>, {:read_timeout=>120}) (keyword arguments)
              got: (#<URI::HTTPS https://github.com/thoughtbot/paper:clip.jpg>, {:read_timeout=>120}) (options hash)
     # ./spec/paperclip/io_adapters/uri_adapter_spec.rb:226:in `block (4 levels) in <top (required)>'

  2) Paperclip Calling Paperclip.run with a logger passes the defined logger if :log_command is set
     Failure/Error: Terrapin::CommandLine.new(cmd, arguments, local_options).run(interpolation_values)

       #<Terrapin::CommandLine (class)> received :new with unexpected arguments
         expected: ("convert", "stuff", {:logger=>#<Logger:0x000000013f6c23a8 @level=0, @progname=nil, @default_formatter=#<Logger::Formatter...ug.log>, @binmode=false, @mon_data=#<Monitor:0x000000013f6c2060>, @mon_data_
owner_object_id=54180>>}) (keyword arguments)
              got: ("convert", "stuff", {:logger=>#<Logger:0x000000013f6c23a8 @level=0, @progname=nil, @default_formatter=#<Logger::Formatter...ug.log>, @binmode=false, @mon_data=#<Monitor:0x000000013f6c2060>, @mon_data_
owner_object_id=54180>>}) (options hash)
     # ./lib/paperclip/helpers.rb:35:in `run'
     # ./spec/paperclip/paperclip_spec.rb:67:in `block (3 levels) in <top (required)>'
...

Copy link

@mattwd7 mattwd7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes plz!

@jasonpenny
Copy link
Author

@ssinghi can I get a review on this?

@jasonpenny
Copy link
Author

@amanksingh01-kreeti can I get a review on this?

@ssinghi ssinghi merged commit 93a1400 into kreeti:master Jul 20, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants