Permalink
Browse files

Add test using identity map and select.

  • Loading branch information...
1 parent 22696b5 commit 1c88d59891d11bd60a07f35a15c0043e0f8cf28a @miloops miloops committed Nov 18, 2010
Showing with 14 additions and 0 deletions.
  1. +14 −0 activerecord/test/cases/identity_map_test.rb
@@ -366,6 +366,20 @@ def test_find_using_identity_map_respects_readonly
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

0 comments on commit 1c88d59

Please sign in to comment.