From 28ee88ca9a09d8afa3b190ddff623657f2098310 Mon Sep 17 00:00:00 2001 From: Jo Liss Date: Mon, 29 Oct 2012 22:01:56 +0100 Subject: [PATCH] In the test, use the same :hash across serializers Otherwise, `include!` will not remember the unique_values of already-sideloaded hashes across serializer calls. --- test/association_test.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/association_test.rb b/test/association_test.rb index d174e196..a87e9936 100644 --- a/test/association_test.rb +++ b/test/association_test.rb @@ -30,6 +30,9 @@ class AssociationTest < ActiveModel::TestCase end def setup + @hash = {} + @root_hash = {} + @post = Model.new(:title => "New Post", :body => "Body") @comment = Model.new(:id => 1, :body => "ZOMG A COMMENT") @post.comments = [ @comment ] @@ -43,17 +46,13 @@ class AssociationTest < ActiveModel::TestCase attributes :title, :body end - @post_serializer = @post_serializer_class.new(@post) - - @hash = {} - @root_hash = {} + @post_serializer = @post_serializer_class.new(@post, :hash => @root_hash) end def include!(key, options={}) @post_serializer.include! key, { :embed => :ids, :include => true, - :hash => @root_hash, :node => @hash, :serializer => @comment_serializer_class }.merge(options) @@ -61,7 +60,6 @@ class AssociationTest < ActiveModel::TestCase def include_bare!(key, options={}) @post_serializer.include! key, { - :hash => @root_hash, :node => @hash, :serializer => @comment_serializer_class }.merge(options)