mirror of
https://github.com/github/rails.git
synced 2026-01-09 14:48:08 -05:00
add regression test for set_inverse_instance on add_to_target
This commit is contained in:
@@ -290,6 +290,19 @@ class InverseHasManyTests < ActiveRecord::TestCase
|
||||
def test_trying_to_use_inverses_that_dont_exist_should_raise_an_error
|
||||
assert_raise(ActiveRecord::InverseOfAssociationNotFoundError) { Man.find(:first).secret_interests }
|
||||
end
|
||||
|
||||
def test_child_instance_should_point_to_parent_without_saving
|
||||
man = Man.new
|
||||
i = Interest.create(:topic => 'Industrial Revolution Re-enactment')
|
||||
|
||||
man.interests << i
|
||||
assert_not_nil i.man
|
||||
|
||||
i.man.name = "Charles"
|
||||
assert_equal i.man.name, man.name
|
||||
|
||||
assert !man.persisted?
|
||||
end
|
||||
end
|
||||
|
||||
class InverseBelongsToTests < ActiveRecord::TestCase
|
||||
|
||||
Reference in New Issue
Block a user