diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-04-15 13:09:12 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-04-15 13:09:12 +0100 |
commit | e01dfb27fc5573db9070dce788f2e5ee62094722 (patch) | |
tree | 5b84264cf61681efbe9c8b6f3e9d00d25fc0ddce /activerecord/test | |
parent | e68a83c9ecdc5b9395e0dde687cafdf8330f9de0 (diff) | |
download | rails-e01dfb27fc5573db9070dce788f2e5ee62094722.tar.gz rails-e01dfb27fc5573db9070dce788f2e5ee62094722.tar.bz2 rails-e01dfb27fc5573db9070dce788f2e5ee62094722.zip |
Undo performances regressions I introduced in bbe0a507f287c20ab4ae8a244fbfc810665deda5 and add test for an edge case. Add comments to explain the intent of the code.
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 899166d129..5074ae50ab 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -10,6 +10,7 @@ require 'models/company' require 'models/category' require 'models/reply' require 'models/contact' +require 'models/keyboard' class AttributeMethodsTest < ActiveRecord::TestCase fixtures :topics, :developers, :companies, :computers @@ -89,6 +90,16 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert !topic.respond_to?(:nothingness) end + def test_respond_to_with_custom_primary_key + keyboard = Keyboard.create + assert_not_nil keyboard.key_number + assert_equal keyboard.key_number, keyboard.id + assert keyboard.respond_to?('key_number') + assert keyboard.respond_to?('_key_number') + assert keyboard.respond_to?('id') + assert keyboard.respond_to?('_id') + end + # Syck calls respond_to? before actually calling initialize def test_respond_to_with_allocated_object topic = Topic.allocate |