Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test case for rails#8125 => passes
  • Loading branch information
senny committed Nov 11, 2012
1 parent 12d6d3a commit cfb140a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Expand Up @@ -164,7 +164,15 @@ def test_trying_to_use_inverses_that_dont_exist_should_raise_an_error
end

class InverseHasManyTests < ActiveRecord::TestCase
fixtures :men, :interests
fixtures :men, :interests, :zines

def test_inverse_of_and_association_ids_works_with_through_association
peter = Man.new(:zine_ids => [zines(:staying_in).id, zines(:going_out).id])
assert_difference 'peter.interests.count', 2 do
peter.save!
end
assert_equal 2, peter.zines.count
end

def test_parent_instance_should_be_shared_with_every_child_on_find
m = men(:gordon)
Expand Down
1 change: 1 addition & 0 deletions activerecord/test/models/man.rb
Expand Up @@ -2,6 +2,7 @@ class Man < ActiveRecord::Base
has_one :face, :inverse_of => :man
has_one :polymorphic_face, :class_name => 'Face', :as => :polymorphic_man, :inverse_of => :polymorphic_man
has_many :interests, :inverse_of => :man
has_many :zines, :through => :interests
has_many :polymorphic_interests, :class_name => 'Interest', :as => :polymorphic_man, :inverse_of => :polymorphic_man
# These are "broken" inverse_of associations for the purposes of testing
has_one :dirty_face, :class_name => 'Face', :inverse_of => :dirty_man
Expand Down

0 comments on commit cfb140a

Please sign in to comment.