diff options
author | Michael Koziarski <michael@koziarski.com> | 2010-12-02 15:36:05 +1300 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-02 08:40:34 -0800 |
commit | 96eec090dfd50326146b2f690408fefec50c5111 (patch) | |
tree | 55bef0491b1bca2679bd6e3defe8174b637b4b99 /activerecord/test | |
parent | 0afebd5b31bdc6edc1399c77153e65f5ea156fe1 (diff) | |
download | rails-96eec090dfd50326146b2f690408fefec50c5111.tar.gz rails-96eec090dfd50326146b2f690408fefec50c5111.tar.bz2 rails-96eec090dfd50326146b2f690408fefec50c5111.zip |
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.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/attribute_methods_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
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 |