mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added test for exception message for validate method
- Test case for https://github.com/rails/rails/pull/16851
This commit is contained in:
parent
fc6accfa9a
commit
a7ed62987c
1 changed files with 3 additions and 1 deletions
|
@ -167,10 +167,12 @@ class ValidationsTest < ActiveModel::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_options_to_validate
|
def test_invalid_options_to_validate
|
||||||
assert_raises(ArgumentError) do
|
error = assert_raises(ArgumentError) do
|
||||||
# A common mistake -- we meant to call 'validates'
|
# A common mistake -- we meant to call 'validates'
|
||||||
Topic.validate :title, presence: true
|
Topic.validate :title, presence: true
|
||||||
end
|
end
|
||||||
|
message = 'Unknown key: :presence. Valid keys are: :on, :if, :unless. Perhaps you meant to call `validates` instead of `validate`?'
|
||||||
|
assert_equal message, error.message
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_errors_conversions
|
def test_errors_conversions
|
||||||
|
|
Loading…
Reference in a new issue