Fix frozen string in validatable, use multiline string instead. (#5563)

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 #5465

[changed in Ruby 3] https://bugs.ruby-lang.org/issues/17104

Co-authored-by: Martin <martin@edv-beratung-meier.de>
This commit is contained in:
Carlos Antonio da Silva
2023-03-01 19:56:25 -03:00
committed by GitHub
parent 41e2db2120
commit ee8f0f8e83
3 changed files with 7 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
### Unreleased
* bug fixes
* Fix frozen string exception in validatable. [#5563](https://github.com/heartcombo/devise/pull/5563) [#5465](https://github.com/heartcombo/devise/pull/5465) [@mameier](https://github.com/mameier)
### 4.9.0 - 2023-02-17