diff options
Diffstat (limited to 'activerecord/test/cases/identity_map_test.rb')
-rw-r--r-- | activerecord/test/cases/identity_map_test.rb | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/activerecord/test/cases/identity_map_test.rb b/activerecord/test/cases/identity_map_test.rb index 915f3abd26..bc0ceae605 100644 --- a/activerecord/test/cases/identity_map_test.rb +++ b/activerecord/test/cases/identity_map_test.rb @@ -70,14 +70,22 @@ class IdentityMapTest < ActiveRecord::TestCase assert_same(t1, t2) end - def test_updating_of_pkey - s = Subscriber.find_by_nick('swistak') - assert s.update_attribute(:nick, 'swistakTheJester') - assert_equal('swistakTheJester', s.nick) - - assert stj = Subscriber.find_by_nick('swistakTheJester') - assert_same(s, stj) - 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 +# assert client = Client.find(3), +# client.update_attribute(:id, 666) +# +# assert Client.find(666) +# assert_same(client, Client.find(666)) +# +# s = Subscriber.find_by_nick('swistak') +# assert s.update_attribute(:nick, 'swistakTheJester') +# assert_equal('swistakTheJester', s.nick) +# +# assert stj = Subscriber.find_by_nick('swistakTheJester') +# assert_same(s, stj) +# end def test_changing_associations t1 = Topic.create("title" => "t1") @@ -176,7 +184,7 @@ class IdentityMapTest < ActiveRecord::TestCase end assert_equal posts(:welcome, :thinking), posts - posts = assert_queries(2) do + posts = assert_queries(1) do Post.find(:all, :include => :author, :joins => {:taggings => {:tag => :taggings}}, :conditions => "taggings_tags.super_tag_id=2", :order => 'posts.id') end assert_equal posts(:welcome, :thinking), posts @@ -195,4 +203,10 @@ class IdentityMapTest < ActiveRecord::TestCase assert_equal [posts(:welcome)], posts assert_equal authors(:david), assert_no_queries { posts[0].author} end + + # Second search should not change read only status for collection + def test_find_with_joins_option_implies_readonly + Developer.joins(', projects').each { |d| assert d.readonly? } + Developer.joins(', projects').readonly(false).each { |d| assert d.readonly? } + end end |