Permalink
Browse files

add test which fails for has_many through self join [#4361 state:open]

  • Loading branch information...
1 parent f2234a5 commit 00c893d3b86be3a141c21ed065e085adbb26062a @ziggurism ziggurism committed with tenderlove May 2, 2010
Showing with 7 additions and 0 deletions.
  1. +7 −0 activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -388,6 +388,13 @@ def test_modifying_has_many_through_has_one_reflection_should_raise
].each {|block| assert_raise(ActiveRecord::HasManyThroughCantAssociateThroughHasOneOrManyReflection, &block) }
end
+ def test_has_many_association_through_a_has_many_association_to_self
+ sarah = Person.create!(:first_name => 'Sarah', :primary_contact_id => people(:susan).id, :gender => 'F', :number1_fan_id => 1)
+ john = Person.create!(:first_name => 'John', :primary_contact_id => sarah.id, :gender => 'M', :number1_fan_id => 1)
+ assert_equal sarah.agents, [john]
+ assert_equal people(:susan).agents_of_agents, [john]
+ end
+
def test_collection_singular_ids_getter_with_string_primary_keys
book = books(:awdr)
assert_equal 2, book.subscriber_ids.size

0 comments on commit 00c893d

Please sign in to comment.