shrinerb / shrine

File Attachment toolkit for Ruby applications
https://shrinerb.com
MIT License
3.18k stars 275 forks source link

Test with Ruby 3.1 #564

Closed aried3r closed 2 years ago

aried3r commented 2 years ago
aried3r commented 2 years ago
  1) Error:
plugin system::Shrine.plugin::when called globally#test_0001_allows the plugin to override base methods of core classes:
NoMethodError: undefined method `allocate' for Shrine::Attachment:Class

        assert_equal :foo, Shrine::Attachment.allocate.foo
                                             ^^^^^^^^^
    /home/runner/work/shrine/shrine/test/plugin_test.rb:46:in `block (4 levels) in <top (required)>'

I'm not quite sure why this fails and why only the last line.

https://github.com/shrinerb/shrine/blob/f62b7c3e7df4ab54f3a92fc009987d418645d10a/test/plugin_test.rb#L39-L46

I couldn't find anything immediately in either https://ruby-doc.org/core-3.1.0/NEWS_md.html or https://rubyreferences.github.io/rubychanges/3.1.html searching for allocate.

janko commented 2 years ago

Thanks for the pull request!

Interesting 🤔 Shrine::Attachment is a subclass of Module, which in turn is an instance of Class, which should have #allocate instance method. I'll investigate.

janko commented 2 years ago

I don't know why, but it seems that Module.allocate method has been removed in Ruby 3.1. I pushed a workaround for tests.