aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/associations_test.rb')
-rwxr-xr-xactiverecord/test/associations_test.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb
index 8f60fc95f1..03c344de7c 100755
--- a/activerecord/test/associations_test.rb
+++ b/activerecord/test/associations_test.rb
@@ -1039,7 +1039,20 @@ class BelongsToAssociationsTest < Test::Unit::TestCase
citibank.firm = apple
assert_equal apple.id, citibank.firm_id
end
-
+
+ def test_no_unexpected_aliasing
+ first_firm = companies(:first_firm)
+ another_firm = companies(:another_firm)
+
+ citibank = Account.create("credit_limit" => 10)
+ citibank.firm = first_firm
+ original_proxy = citibank.firm
+ citibank.firm = another_firm
+
+ assert_equal first_firm.object_id, original_proxy.object_id
+ assert_equal another_firm.object_id, citibank.firm.object_id
+ end
+
def test_creating_the_belonging_object
citibank = Account.create("credit_limit" => 10)
apple = citibank.create_firm("name" => "Apple")