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

Add test to avoid regression of 58e48d5292

This commit is contained in:
Gabriel Sobrinho & Ricardo Henrique 2012-11-08 15:19:44 -02:00 committed by Gabriel Sobrinho
parent 9abec81622
commit 6876f4a787

View file

@ -185,6 +185,17 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase
assert_equal "James", mean_pirate.parrot.name
assert_equal "blue", mean_pirate.parrot.color
end
def test_accepts_nested_attributes_for_can_be_overridden_in_subclasses
Pirate.accepts_nested_attributes_for(:parrot)
mean_pirate_class = Class.new(Pirate) do
accepts_nested_attributes_for :parrot
end
mean_pirate = mean_pirate_class.new
mean_pirate.parrot_attributes = { :name => "James" }
assert_equal "James", mean_pirate.parrot.name
end
end
class TestNestedAttributesOnAHasOneAssociation < ActiveRecord::TestCase