aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-05-15 09:32:46 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-05-15 09:32:46 -0700
commit9a868a01b8449fe9bedaee3d4c946f8409b42417 (patch)
tree54de3b7bc8724f47537949ef60d995ec1c2af670 /activemodel/test
parent007539d12d64764db3f7fd13f134804e233ac99d (diff)
parent396e383286ccc368b54e980e06a506d339843594 (diff)
downloadrails-9a868a01b8449fe9bedaee3d4c946f8409b42417.tar.gz
rails-9a868a01b8449fe9bedaee3d4c946f8409b42417.tar.bz2
rails-9a868a01b8449fe9bedaee3d4c946f8409b42417.zip
Merge pull request #6324 from acapilleri/dup_validation_3_2
Dup validation 3 2
Diffstat (limited to 'activemodel/test')
-rw-r--r--activemodel/test/cases/validations_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activemodel/test/cases/validations_test.rb b/activemodel/test/cases/validations_test.rb
index 1941031e3c..56c9a5592c 100644
--- a/activemodel/test/cases/validations_test.rb
+++ b/activemodel/test/cases/validations_test.rb
@@ -339,4 +339,19 @@ class ValidationsTest < ActiveModel::TestCase
end
assert_equal "Title can't be blank", exception.message
end
+
+ def test_dup_validity_is_independent
+ Topic.validates_presence_of :title
+ topic = Topic.new("title" => "Litterature")
+ topic.valid?
+
+ duped = topic.dup
+ duped.title = nil
+ assert duped.invalid?
+
+ topic.title = nil
+ duped.title = 'Mathematics'
+ assert topic.invalid?
+ assert duped.valid?
+ end
end