aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorAndreas Neuhaus <zargony@zargony.com>2008-05-08 00:04:53 -0500
committerJoshua Peek <josh@joshpeek.com>2008-05-08 00:04:53 -0500
commitbcb090c56b842a76397e0ea32f54c942fd11910e (patch)
tree2921e7b7b80559f1e20a335da021fdd308993eab /activerecord/test/cases
parent2561732a08ae97fa44706a8eca4db147c4a7c286 (diff)
downloadrails-bcb090c56b842a76397e0ea32f54c942fd11910e.tar.gz
rails-bcb090c56b842a76397e0ea32f54c942fd11910e.tar.bz2
rails-bcb090c56b842a76397e0ea32f54c942fd11910e.zip
Calling ActiveRecord#inspect on an unloaded association won't wipe the collection [#9 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activerecord/test/cases')
-rwxr-xr-xactiverecord/test/cases/associations_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb
index ed2fab6d22..d8fe98bf57 100755
--- a/activerecord/test/cases/associations_test.rb
+++ b/activerecord/test/cases/associations_test.rb
@@ -149,6 +149,12 @@ class AssociationProxyTest < ActiveRecord::TestCase
assert !david.projects.loaded?
end
+ def test_inspect_does_not_reload_a_not_yet_loaded_target
+ andreas = Developer.new :name => 'Andreas', :log => 'new developer added'
+ assert !andreas.audit_logs.loaded?
+ assert_match(/message: "new developer added"/, andreas.audit_logs.inspect)
+ end
+
def test_save_on_parent_saves_children
developer = Developer.create :name => "Bryan", :salary => 50_000
assert_equal 1, developer.reload.audit_logs.size