diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2014-09-20 09:03:03 -0700 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2014-09-28 16:17:06 -0700 |
commit | 9d569585a20ddd9ddb3602921f2ccffc208998d8 (patch) | |
tree | 97f5ee9a38a958f3bf60c1f1f972b8549f9cedb5 /activerecord/test | |
parent | 482e80e84440136763b47c0fba2ed65a7823f022 (diff) | |
download | rails-9d569585a20ddd9ddb3602921f2ccffc208998d8.tar.gz rails-9d569585a20ddd9ddb3602921f2ccffc208998d8.tar.bz2 rails-9d569585a20ddd9ddb3602921f2ccffc208998d8.zip |
Isolate access to @associations_cache and @aggregations cache to the Associations and Aggregations modules, respectively.
This includes replacing the `association_cache` accessor with a more
limited `association_cached?` accessor and making `clear_association_cache`
and `clear_aggregation_cache` private.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/associations_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/inheritance_test.rb | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 25555bd75c..e3ddcd98c0 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -92,14 +92,14 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase Firm.create("name" => "Apple") Client.create("name" => "Citibank", :firm_name => "Apple") citibank_result = Client.all.merge!(:where => {:name => "Citibank"}, :includes => :firm_with_primary_key).first - assert citibank_result.association_cache.key?(:firm_with_primary_key) + assert citibank_result.association_cached?(:firm_with_primary_key) end def test_eager_loading_with_primary_key_as_symbol Firm.create("name" => "Apple") Client.create("name" => "Citibank", :firm_name => "Apple") citibank_result = Client.all.merge!(:where => {:name => "Citibank"}, :includes => :firm_with_primary_key_symbols).first - assert citibank_result.association_cache.key?(:firm_with_primary_key_symbols) + assert citibank_result.association_cached?(:firm_with_primary_key_symbols) end def test_creating_the_belonging_object diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 9b0cf4c18f..c40bcd068c 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -46,7 +46,7 @@ class AssociationsTest < ActiveRecord::TestCase firm = Firm.find(1) assert_kind_of Firm, firm - firm.clear_association_cache + firm.send(:clear_association_cache) assert_equal Firm.find(1).clients.collect{ |x| x.name }.sort, firm.clients.collect{ |x| x.name }.sort end @@ -60,7 +60,7 @@ class AssociationsTest < ActiveRecord::TestCase firm.clients << clients assert_equal clients.map(&:name).to_set, firm.clients.map(&:name).to_set - firm.clear_association_cache + firm.send(:clear_association_cache) assert_equal clients.map(&:name).to_set, firm.clients.map(&:name).to_set end diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index 792950d24d..969e71898a 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -294,12 +294,12 @@ class InheritanceTest < ActiveRecord::TestCase def test_eager_load_belongs_to_something_inherited account = Account.all.merge!(:includes => :firm).find(1) - assert account.association_cache.key?(:firm), "nil proves eager load failed" + assert account.association_cached?(:firm), "nil proves eager load failed" end def test_alt_eager_loading cabbage = RedCabbage.all.merge!(:includes => :seller).find(4) - assert cabbage.association_cache.key?(:seller), "nil proves eager load failed" + assert cabbage.association_cached?(:seller), "nil proves eager load failed" end def test_eager_load_belongs_to_primary_key_quoting |