mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #8145 from sobrinho/master
Add test to avoid regression of 58e48d5
This commit is contained in:
commit
772883c590
1 changed files with 11 additions and 0 deletions
|
@ -185,6 +185,17 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase
|
||||||
assert_equal "James", mean_pirate.parrot.name
|
assert_equal "James", mean_pirate.parrot.name
|
||||||
assert_equal "blue", mean_pirate.parrot.color
|
assert_equal "blue", mean_pirate.parrot.color
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
class TestNestedAttributesOnAHasOneAssociation < ActiveRecord::TestCase
|
class TestNestedAttributesOnAHasOneAssociation < ActiveRecord::TestCase
|
||||||
|
|
Loading…
Reference in a new issue