From 96eec090dfd50326146b2f690408fefec50c5111 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Thu, 2 Dec 2010 15:36:05 +1300 Subject: Work around a strange piece of Syck behaviour where it checks Model#respond_to? before initializing the object. Things like YAML.load(YAML.dump(@post)) won't work without this. --- activerecord/test/cases/attribute_methods_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'activerecord/test/cases/attribute_methods_test.rb') diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index bb0166a60c..3df8197e0d 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -85,6 +85,17 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert !topic.respond_to?("nothingness") assert !topic.respond_to?(:nothingness) end + + + # Syck calls respond_to? before actually calling initialize + def test_respond_to_with_allocated_object + topic = Topic.allocate + assert !topic.respond_to?("nothingness") + assert !topic.respond_to?(:nothingness) + assert_respond_to topic, "title" + assert_respond_to topic, :title + end + def test_array_content topic = Topic.new -- cgit v1.2.3 From 077ec5a0ed3459816a4666364c722bb512c09bc7 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 2 Dec 2010 08:41:54 -0800 Subject: fixing space errors --- activerecord/test/cases/attribute_methods_test.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'activerecord/test/cases/attribute_methods_test.rb') diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 3df8197e0d..8214815bde 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -85,8 +85,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert !topic.respond_to?("nothingness") assert !topic.respond_to?(:nothingness) end - - + # Syck calls respond_to? before actually calling initialize def test_respond_to_with_allocated_object topic = Topic.allocate @@ -95,7 +94,6 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert_respond_to topic, "title" assert_respond_to topic, :title end - def test_array_content topic = Topic.new -- cgit v1.2.3