aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2012-02-01 06:05:02 -0800
committerJosé Valim <jose.valim@plataformatec.com.br>2012-02-01 06:05:02 -0800
commit0696a514bc5809cb77a6bd730277fd776e3f4475 (patch)
treee809eebc5932f72895fffe283279e24616f1a1b7 /activemodel/test/cases
parent21735d225d43b389baf0cc3ed32b9ccc0000e08d (diff)
parent91f8cf22647e2e102c0897e88faec049f606843f (diff)
downloadrails-0696a514bc5809cb77a6bd730277fd776e3f4475.tar.gz
rails-0696a514bc5809cb77a6bd730277fd776e3f4475.tar.bz2
rails-0696a514bc5809cb77a6bd730277fd776e3f4475.zip
Merge pull request #4822 from carlosantoniodasilva/strict-validation-3-2
Generate strict validation error messages with attribute name (3-2-stable)
Diffstat (limited to 'activemodel/test/cases')
-rw-r--r--activemodel/test/cases/validations_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activemodel/test/cases/validations_test.rb b/activemodel/test/cases/validations_test.rb
index 2f4376bd41..1941031e3c 100644
--- a/activemodel/test/cases/validations_test.rb
+++ b/activemodel/test/cases/validations_test.rb
@@ -311,7 +311,7 @@ class ValidationsTest < ActiveModel::TestCase
end
def test_strict_validation_particular_validator
- Topic.validates :title, :presence => {:strict => true}
+ Topic.validates :title, :presence => { :strict => true }
assert_raises ActiveModel::StrictValidationFailed do
Topic.new.valid?
end
@@ -330,4 +330,13 @@ class ValidationsTest < ActiveModel::TestCase
Topic.new.valid?
end
end
+
+ def test_strict_validation_error_message
+ Topic.validates :title, :strict => true, :presence => true
+
+ exception = assert_raises(ActiveModel::StrictValidationFailed) do
+ Topic.new.valid?
+ end
+ assert_equal "Title can't be blank", exception.message
+ end
end