heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
23.89k stars 5.54k forks source link

Fix frozen string in validatable module #5563

Closed carlosantoniodasilva closed 1 year ago

carlosantoniodasilva commented 1 year ago

Expand tests to check for the actual validatable exception message

This was raising a FrozenError on Ruby < 3 where interpolated strings were considered frozen. This [changed in Ruby 3], since such strings are dynamic there's no point in freezing them by default.

The test wasn't catching this because FrozenError actually inherits from RuntimeError:

FrozenError.ancestors => [FrozenError, RuntimeError, StandardError, Exception, Object ...]

So the exception check passed. Now we're also checking for the error message to ensure it raised the exception we really expected there.

Closes https://github.com/heartcombo/devise/pull/5465