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:
parent
f667f0f7ee
commit
59e2630ca7
1 changed files with 12 additions and 10 deletions
|
@ -108,18 +108,20 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dup_validity_is_independent
|
def test_dup_validity_is_independent
|
||||||
Topic.validates_presence_of :title
|
repair_validations(Topic) do
|
||||||
topic = Topic.new("title" => "Litterature")
|
Topic.validates_presence_of :title
|
||||||
topic.valid?
|
topic = Topic.new("title" => "Litterature")
|
||||||
|
topic.valid?
|
||||||
|
|
||||||
duped = topic.dup
|
duped = topic.dup
|
||||||
duped.title = nil
|
duped.title = nil
|
||||||
assert duped.invalid?
|
assert duped.invalid?
|
||||||
|
|
||||||
topic.title = nil
|
topic.title = nil
|
||||||
duped.title = 'Mathematics'
|
duped.title = 'Mathematics'
|
||||||
assert topic.invalid?
|
assert topic.invalid?
|
||||||
assert duped.valid?
|
assert duped.valid?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue