aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-04-25 16:04:57 +0100
committerJon Leighton <j@jonathanleighton.com>2012-04-25 16:04:57 +0100
commit98de70e2e12cff98acbc38727e709ff99db331b6 (patch)
tree0ce7f43f5b326e626a5f527287ada2af50d5ca6d /activerecord/test
parentd242e467819a428ad7e302968e4c9fa1e26d9326 (diff)
downloadrails-98de70e2e12cff98acbc38727e709ff99db331b6.tar.gz
rails-98de70e2e12cff98acbc38727e709ff99db331b6.tar.bz2
rails-98de70e2e12cff98acbc38727e709ff99db331b6.zip
add missing test
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb
index 9dd041af81..58808871de 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -705,4 +705,16 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
assert_equal toy, sponsor.reload.sponsorable
end
+
+ test "stale tracking doesn't care about the type" do
+ apple = Firm.create("name" => "Apple")
+ citibank = Account.create("credit_limit" => 10)
+
+ citibank.firm_id = apple.id
+ citibank.firm # load it
+
+ citibank.firm_id = apple.id.to_s
+
+ assert !citibank.association(:firm).stale_target?
+ end
end