Skip to content
Browse files

Add test to avoid regression of 58e48d5

  • Loading branch information...
1 parent 9abec81 commit 6876f4a787249146517b01efaaa0a5b27ee0350b Gabriel Sobrinho & Ricardo Henrique committed with sobrinho Nov 8, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 activerecord/test/cases/nested_attributes_test.rb
View
11 activerecord/test/cases/nested_attributes_test.rb
@@ -185,6 +185,17 @@ def parrot_attributes=(attrs)
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

0 comments on commit 6876f4a

Please sign in to comment.
Something went wrong with that request. Please try again.