From 5af1ebbd9a0f7394925674104fcb522a4485b8bb Mon Sep 17 00:00:00 2001 From: evanweaver Date: Wed, 22 Aug 2007 07:23:49 +0000 Subject: [PATCH] update tests git-svn-id: svn://rubyforge.org/var/svn/fauna/has_many_polymorphs/trunk@663 c1ad287d-65d5-445d-b84c-e64f8492f1e6 --- test/models/petfood.rb | 4 ++-- test/unit/polymorph_test.rb | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/test/models/petfood.rb b/test/models/petfood.rb index 87b531a..df420ea 100644 --- a/test/models/petfood.rb +++ b/test/models/petfood.rb @@ -23,8 +23,8 @@ class Petfood < ActiveRecord::Base :ignore_duplicates => false, :conditions => "NULL IS NULL", :order => "eaters_foodstuffs.updated_at ASC", - :parent_order => "the_petfood_primary_key DESC", - :parent_conditions => "name != 'Snausages'", + :parent_order => "petfoods.the_petfood_primary_key DESC", + :parent_conditions => "petfoods.name IS NULL OR petfoods.name != 'Snausages'", :extend => [ExtensionModule, OtherExtensionModule, proc {}], :join_extend => proc { def a_method diff --git a/test/unit/polymorph_test.rb b/test/unit/polymorph_test.rb index 31eb568..c17ce45 100644 --- a/test/unit/polymorph_test.rb +++ b/test/unit/polymorph_test.rb @@ -607,9 +607,14 @@ class PolymorphTest < Test::Unit::TestCase def test_self_referential_hmp_with_conditions p = Person.find(:first) - p.kids << (kid = Person.create(:name => "Tim", :age => 3)) - p.reload + kid = Person.create(:name => "Tim", :age => 3) + p.kids << kid + + kid.reload; p.reload + + assert_equal [p], kid.parents assert_equal [kid], p.kids + assert_equal [kid], p.people end # def test_polymorphic_include -- 2.11.4.GIT