1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Missing repair_validations

This commit is contained in:
Akira Matsuda 2013-01-09 11:07:37 +09:00
parent f667f0f7ee
commit 59e2630ca7

View file

@ -108,18 +108,20 @@ module ActiveRecord
end
def test_dup_validity_is_independent
Topic.validates_presence_of :title
topic = Topic.new("title" => "Litterature")
topic.valid?
repair_validations(Topic) do
Topic.validates_presence_of :title
topic = Topic.new("title" => "Litterature")
topic.valid?
duped = topic.dup
duped.title = nil
assert duped.invalid?
duped = topic.dup
duped.title = nil
assert duped.invalid?
topic.title = nil
duped.title = 'Mathematics'
assert topic.invalid?
assert duped.valid?
topic.title = nil
duped.title = 'Mathematics'
assert topic.invalid?
assert duped.valid?
end
end
end
end