aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/validations/presence_validation_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-26 18:20:48 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-26 18:55:47 -0300
commit78fd14c8de9577f92ee78ba399ca716589465465 (patch)
treeef36965587b9f6df7a88a99e7b06dc5d0fd3c421 /activemodel/test/cases/validations/presence_validation_test.rb
parentd4c30a0226386f291bd8b1959fed12b3aca19164 (diff)
downloadrails-78fd14c8de9577f92ee78ba399ca716589465465.tar.gz
rails-78fd14c8de9577f92ee78ba399ca716589465465.tar.bz2
rails-78fd14c8de9577f92ee78ba399ca716589465465.zip
Revert the change at ActiveModel::Errors#add_on_blank and fix in the
right place. The EachValidator#validate already handle :allow_blank and :allow_nil, correctly. Closes #8622. Fix #8621.
Diffstat (limited to 'activemodel/test/cases/validations/presence_validation_test.rb')
-rw-r--r--activemodel/test/cases/validations/presence_validation_test.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activemodel/test/cases/validations/presence_validation_test.rb b/activemodel/test/cases/validations/presence_validation_test.rb
index fe2ee7b409..f77d4da29f 100644
--- a/activemodel/test/cases/validations/presence_validation_test.rb
+++ b/activemodel/test/cases/validations/presence_validation_test.rb
@@ -41,7 +41,7 @@ class PresenceValidationTest < ActiveModel::TestCase
end
def test_validates_acceptance_of_with_custom_error_using_quotes
- Person.validates_presence_of :karma, :message => "This string contains 'single' and \"double\" quotes"
+ Person.validates_presence_of :karma, message: "This string contains 'single' and \"double\" quotes"
p = Person.new
assert p.invalid?
assert_equal "This string contains 'single' and \"double\" quotes", p.errors[:karma].last
@@ -72,9 +72,9 @@ class PresenceValidationTest < ActiveModel::TestCase
end
def test_allow_nil
- Topic.validates_presence_of(:title, :allow_nil => true)
+ Topic.validates_presence_of(:title, allow_nil: true)
- t = Topic.new(:title => "something")
+ t = Topic.new(title: "something")
assert t.valid?, t.errors.full_messages
t.title = ""
@@ -90,9 +90,9 @@ class PresenceValidationTest < ActiveModel::TestCase
end
def test_allow_blank
- Topic.validates_presence_of(:title, :allow_blank => true)
+ Topic.validates_presence_of(:title, allow_blank: true)
- t = Topic.new(:title => "something")
+ t = Topic.new(title: "something")
assert t.valid?, t.errors.full_messages
t.title = ""