Skip to content

Instantly share code, notes, and snippets.

@zgchurch
Created November 21, 2012 22:02
Show Gist options
  • Save zgchurch/4128152 to your computer and use it in GitHub Desktop.
Save zgchurch/4128152 to your computer and use it in GitHub Desktop.
(my new) failing ActiveRecord test
diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb
index 3f08f9e..fe0d2cc 100644
--- a/activerecord/test/cases/nested_attributes_test.rb
+++ b/activerecord/test/cases/nested_attributes_test.rb
@@ -1000,6 +1000,12 @@ class TestHasOneAutosaveAssociationWhichItselfHasAutosaveAssociations < ActiveRe
ShipPart.create!(:ship => @ship, :name => "Stern")
assert_no_queries { @pirate.valid? }
end
+
+ test "not sure yet" do
+ @pirate.attributes = {:ship_attributes => {:id => @ship.id, :parts_attributes => [{:id => @part.id, :trinkets_attributes => [{:id => @part.id, :name => "changed"}]}]}}
+ # puts @pirate.ship.parts.inspect
+ assert_equal "changed", @pirate.ship.parts.first.trinkets.first.name
+ end
end
@zgchurch
Copy link
Author

This test fails, except when like 12 is not commented out. Something to do with calling inspect or puts'ing that thing causes AR to correctly use what's in memory, rather than (I believe) loading from the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment