From e2b7bba62696313221cd07e08c247aa0edf71533 Mon Sep 17 00:00:00 2001 From: Adrian Mugnolo and Santiago Pastorino Date: Mon, 16 Dec 2013 17:10:13 -0200 Subject: [PATCH] Stub out comments writer when needed --- test/fixtures/poro.rb | 2 -- test/unit/active_model/array_serializer/serialization_test.rb | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/fixtures/poro.rb b/test/fixtures/poro.rb index 66ab74ee..a43954b5 100644 --- a/test/fixtures/poro.rb +++ b/test/fixtures/poro.rb @@ -26,8 +26,6 @@ class Profile < Model end class Post < Model - attr_writer :comments - def comments @comments ||= [Comment.new(content: 'C1'), Comment.new(content: 'C2')] diff --git a/test/unit/active_model/array_serializer/serialization_test.rb b/test/unit/active_model/array_serializer/serialization_test.rb index c19b51c3..46ea3fcb 100644 --- a/test/unit/active_model/array_serializer/serialization_test.rb +++ b/test/unit/active_model/array_serializer/serialization_test.rb @@ -53,6 +53,10 @@ module ActiveModel @post1 = Post.new({ title: 'Title 1', body: 'Body 1', date: '1/1/2000' }) @post2 = Post.new({ title: 'Title 2', body: 'Body 2', date: '1/1/2000' }) + class << @post2 + attr_writer :comments + end + @post2.comments = [ Comment.new(content: 'C3'), Comment.new(content: 'C4')