aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-11-18 11:03:25 -0300
committerEmilio Tagua <miloops@gmail.com>2010-11-19 19:08:59 -0300
commit1c88d59891d11bd60a07f35a15c0043e0f8cf28a (patch)
tree3fb6b2d9eec3e6a307bdac962db796a193b3d2fc /activerecord/test/cases
parent22696b5b7cb73bd16d03faff61016416d7bb8867 (diff)
downloadrails-1c88d59891d11bd60a07f35a15c0043e0f8cf28a.tar.gz
rails-1c88d59891d11bd60a07f35a15c0043e0f8cf28a.tar.bz2
rails-1c88d59891d11bd60a07f35a15c0043e0f8cf28a.zip
Add test using identity map and select.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/identity_map_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/identity_map_test.rb b/activerecord/test/cases/identity_map_test.rb
index df77bc5af2..74d4cb0bfb 100644
--- a/activerecord/test/cases/identity_map_test.rb
+++ b/activerecord/test/cases/identity_map_test.rb
@@ -366,6 +366,20 @@ class IdentityMapTest < ActiveRecord::TestCase
assert comment.save
end
+ def test_find_using_select_and_identity_map
+ author_id, author = Author.select('id').first, Author.first
+
+ assert_equal author_id, author
+ assert_same author_id, author
+ assert_not_nil author.name
+
+ post, post_id = Post.first, Post.select('id').first
+
+ assert_equal post_id, post
+ assert_same post_id, post
+ assert_not_nil post.title
+ end
+
# Currently AR is not allowing changing primary key (see Persistence#update)
# So we ignore it. If this changes, this test needs to be uncommented.
# def test_updating_of_pkey