1
0
Fork 0
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:
Prathamesh Sonpatki 2014-09-23 14:36:15 +09:00
parent fc6accfa9a
commit a7ed62987c

View file

@ -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