kreeti/kt-paperclip

Compatibility issue with Ruby 3.1

Closed this issue · 1 comments

Describe the bug
I'm getting an error when trying to run kt-paperclip on Ruby 3.1.

To Reproduce
Running current specs using ruby 3.1 the error occurs.
PS: I suppressed other test results because I had difficulty run the entire spec in my local environment.

$ rspec spec/paperclip/storage/s3_spec.rb:1506
Testing against version 7.0.3.1
Run options: include {:locations=>{"./spec/paperclip/storage/s3_spec.rb"=>[1506]}}
F

Failures:

  1) Paperclip::Storage::S3 with S3 credentials in a YAML file and aliases being set runs the file through ERB
     Failure/Error: YAML::safe_load(ERB.new(File.read(creds.path)).result, [], [], true)

     ArgumentError:
       wrong number of arguments (given 4, expected 1)
     # ./lib/paperclip/storage/s3.rb:430:in `find_credentials'
     # ./lib/paperclip/storage/s3.rb:316:in `parse_credentials'
     # ./lib/paperclip/storage/s3.rb:198:in `s3_credentials'
     # ./lib/paperclip/storage/s3.rb:232:in `bucket_name'
     # ./spec/paperclip/storage/s3_spec.rb:1523:in `block (3 levels) in <top (required)>'

Finished in 0.04137 seconds (files took 1.21 seconds to load)
1 example, 1 failure

Expected behavior
The entire spec work properly on Ruby 3.1

Desktop (please complete the following information):

  • OS: Darwin Kernel Version 21.6.0 / Ruby 3.1.2

Additional context
I found this bug when trying to migrate a rails app from Ruby 2.7.6 to Ruby 3.1.
Then I try to reproduce using the project specs but I'm getting some errors running the specs.
Regardless, I was able to reproduce the same error with the spec above.

Apparently the problem is related to the new version of Psych.
https://www.ctrl.blog/entry/ruby-psych4.html

can you confirm you don't have same problem with ruby 3.0.4 ?