Join GitHub today
Inconsistencies with MRI: `FrozenError (can't modify frozen array)` #5160
a = .freeze a << 1
In MRI it's
Note the lowercase
Possible references to other issues
@enebo Yay, thanks for fixing!
Yes, it caused a test failure which matched the exact error message when using Dry::Struct::Value.
It was something along these lines:
require "dry/struct" require "dry/types" require "minitest/autorun" class Image < Dry::Struct::Value attribute :sizes, Array end class ImageTest < MiniTest::Test def test_immutable image = Image.new(sizes: %w[100x100]) e = assert_raises do image.sizes << "200x200" end assert_equal "can't modify frozen Array", e.message end end
On JRuby it failed with:
As a workaround we do:
... assert_equal "can't modify frozen array", e.message.downcase ...
Again, thanks for your blazing fast fix