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.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb
index f912816f33..03431049ae 100755
--- a/activerecord/test/associations_test.rb
+++ b/activerecord/test/associations_test.rb
@@ -14,6 +14,8 @@ require 'fixtures/author'
require 'fixtures/comment'
require 'fixtures/tag'
require 'fixtures/tagging'
+require 'fixtures/person'
+require 'fixtures/reader'
class AssociationsTest < Test::Unit::TestCase
fixtures :accounts, :companies, :developers, :projects, :developers_projects,
@@ -24,6 +26,14 @@ class AssociationsTest < Test::Unit::TestCase
Class.new(ActiveRecord::Base).has_many(:wheels, :name => 'wheels')
end
end
+
+ def test_should_construct_new_finder_sql_after_create
+ person = Person.new
+ assert_equal [], person.readers.find(:all)
+ person.save!
+ reader = Reader.create! :person => person, :post => Post.new(:title => "foo", :body => "bar")
+ assert_equal [reader], person.readers.find(:all)
+ end
def test_force_reload
firm = Firm.new("name" => "A New Firm, Inc")