Permalink
Browse files

Minor tweaks to identity map tests.

  • Loading branch information...
1 parent eeec9ea commit f97b7978af5cbf1aae5c023dc98ef8cc13f066c9 @jnunemaker jnunemaker committed Jan 29, 2010
Showing with 9 additions and 3 deletions.
  1. +9 −3 test/functional/test_identity_map.rb
@@ -365,7 +365,7 @@ class ::Item
key :parent_id, ObjectId
belongs_to :parent, :class_name => 'Item'
- one :child, :class_name => 'Blog'
+ one :blog, :class_name => 'Blog', :foreign_key => 'parent_id'
end
Item.collection.remove
@@ -421,9 +421,15 @@ class ::BlogPost < ::Item
blog = Blog.create(:title => 'Jill')
assert_in_map(blog)
- root = Item.create(:title => 'Root', :child => blog)
+ root = Item.create(:title => 'Root', :blog => blog)
assert_in_map(root)
- root.child.should equal(blog)
+ root.blog.should equal(blog)
+ end
+
+ should "work correctly with one proxy create" do
+ root = Item.create(:title => 'Root')
+ blog = root.blog.create(:title => 'Blog')
+ blog.parent.should equal(root)
end
end

0 comments on commit f97b797

Please sign in to comment.