diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-07 11:28:11 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-07 11:28:11 -0800 |
commit | 839f3bf6822ed3698df1e606c4215d650312f33e (patch) | |
tree | 1f53277c77c8b64679f9bfda1e184a0c4ce91730 /activerecord/test | |
parent | 8a1c5337808c53c5e9d2d842a09a90599c497e89 (diff) | |
download | rails-839f3bf6822ed3698df1e606c4215d650312f33e.tar.gz rails-839f3bf6822ed3698df1e606c4215d650312f33e.tar.bz2 rails-839f3bf6822ed3698df1e606c4215d650312f33e.zip |
just use a hash for doing association caching
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/inheritance_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/modules_test.rb | 1 |
3 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index aaa5421eea..1cb29a0fa1 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -78,14 +78,14 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase Firm.create("name" => "Apple") Client.create("name" => "Citibank", :firm_name => "Apple") citibank_result = Client.find(:first, :conditions => {:name => "Citibank"}, :include => :firm_with_primary_key) - assert_not_nil citibank_result.instance_variable_get("@firm_with_primary_key") + assert citibank_result.association_cache.key?(: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.find(:first, :conditions => {:name => "Citibank"}, :include => :firm_with_primary_key_symbols) - assert_not_nil citibank_result.instance_variable_get("@firm_with_primary_key_symbols") + assert citibank_result.association_cache.key?(:firm_with_primary_key_symbols) end def test_creating_the_belonging_object diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index 9fac9373eb..680d4ca5dd 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -203,7 +203,7 @@ class InheritanceTest < ActiveRecord::TestCase def test_eager_load_belongs_to_something_inherited account = Account.find(1, :include => :firm) - assert_not_nil account.instance_variable_get("@firm"), "nil proves eager load failed" + assert account.association_cache.key?(:firm), "nil proves eager load failed" end def test_eager_load_belongs_to_primary_key_quoting diff --git a/activerecord/test/cases/modules_test.rb b/activerecord/test/cases/modules_test.rb index 14870cb0e2..a2041af16a 100644 --- a/activerecord/test/cases/modules_test.rb +++ b/activerecord/test/cases/modules_test.rb @@ -49,7 +49,6 @@ class ModulesTest < ActiveRecord::TestCase def test_find_account_and_include_company account = MyApplication::Billing::Account.find(1, :include => :firm) - assert_kind_of MyApplication::Business::Firm, account.instance_variable_get('@firm') assert_kind_of MyApplication::Business::Firm, account.firm end |