aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/associations_test.rb')
-rw-r--r--activerecord/test/cases/associations_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb
index 056a29438a..2050d16179 100644
--- a/activerecord/test/cases/associations_test.rb
+++ b/activerecord/test/cases/associations_test.rb
@@ -182,6 +182,18 @@ class AssociationProxyTest < ActiveRecord::TestCase
assert_nil p.author.reset
end
+ def test_reset_loads_association_next_time
+ welcome = posts(:welcome)
+ david = authors(:david)
+ author_assoc = welcome.author
+
+ assert_equal david, welcome.author # So we can be sure the test works correctly
+ author_assoc.reset
+ assert !author_assoc.loaded?
+ assert_nil author_assoc.target
+ assert_equal david, welcome.author
+ end
+
def test_reload_returns_assocition
david = developers(:david)
assert_nothing_raised do