diff options
author | Arturo Pie <arturotd08@yahoo.ca> | 2012-03-25 23:30:34 -0400 |
---|---|---|
committer | Arturo Pie <arturotd08@yahoo.ca> | 2012-03-29 22:23:49 -0400 |
commit | b29e868cc335e2a696c36b6d7ccdf199ed8abf70 (patch) | |
tree | b4d2891083a766fcd224dcd34cf0b96d87bc9b56 | |
parent | 1d753ab6c8bb8d4fb25ddb48d3859fd371bedae6 (diff) | |
download | rails-b29e868cc335e2a696c36b6d7ccdf199ed8abf70.tar.gz rails-b29e868cc335e2a696c36b6d7ccdf199ed8abf70.tar.bz2 rails-b29e868cc335e2a696c36b6d7ccdf199ed8abf70.zip |
Adds a test that breaks IM when using #select
-rw-r--r-- | activerecord/test/cases/identity_map_test.rb | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/activerecord/test/cases/identity_map_test.rb b/activerecord/test/cases/identity_map_test.rb index 24132c7617..2a490126e2 100644 --- a/activerecord/test/cases/identity_map_test.rb +++ b/activerecord/test/cases/identity_map_test.rb @@ -404,18 +404,12 @@ class IdentityMapTest < ActiveRecord::TestCase assert comment.save end - def test_find_using_select_and_identity_map - author_id, author = Author.select('id').order(:id).first, Author.order(:id).first - - assert_equal author_id, author - assert_same author_id, author - assert_not_nil author.name - - post, post_id = Post.order(:id).first, Post.select('id').order(:id).first - - assert_equal post_id, post - assert_same post_id, post - assert_not_nil post.title + def test_do_not_add_to_identity_map_if_record_do_not_contain_all_columns + post = Post.select(:id).first + comment = post.comments[0] + assert_nothing_raised do + assert_not_nil comment.post.title + end end # Currently AR is not allowing changing primary key (see Persistence#update) |