Skip to content

Commit

Permalink
add test which fails for has_many through self join [#4361 state:open]
Browse files Browse the repository at this point in the history
  • Loading branch information
ziggurism authored and tenderlove committed Dec 14, 2010
1 parent f2234a5 commit 00c893d
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -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
Expand Down

0 comments on commit 00c893d

Please sign in to comment.