Merge pull request #17022 from prathamesh-sonpatki/test-for-validate-message

Added test for exception message for validate method
This commit is contained in:
Yves Senn 2014-09-23 10:36:36 +02:00
commit 92cef19519
1 changed files with 3 additions and 1 deletions

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