Skip to content

Test ValidationError exposes model and message - #57544

Merged
rafaelfranca merged 1 commit into
rails:mainfrom
hammadxcm:test-validation-error-model-message
Jun 2, 2026
Merged

rafaelfranca merged 1 commit into
rails:mainfrom
hammadxcm:test-validation-error-model-message

Conversation

@hammadxcm

Copy link
Copy Markdown
Contributor

ActiveModel::ValidationError documents that the invalid model is available via #model, and it builds a "Validation failed: ..." message. The existing validate! tests only asserted that the error was raised, never inspecting the rescued exception.

This adds coverage asserting the raised error exposes the model (#model) and the generated message. No production code changes — test-only.

ActiveModel::ValidationError documents that the invalid model is
available via #model, and it builds a "Validation failed: ..."
message, but the validate! tests only asserted that the error was
raised.

Add coverage asserting the raised error exposes the model and the
generated message.
@rafaelfranca
rafaelfranca merged commit 52ed768 into rails:main Jun 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants