Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Test for has_many bug on unsaved records

See issue #7950.
  • Loading branch information...
commit 3e648599385887d0bd80225bd45db4799902ec02 1 parent 1e9522c
@georgebrock georgebrock authored carlosantoniodasilva committed
View
7 activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1150,6 +1150,13 @@ def test_included_in_collection
assert companies(:first_firm).clients.include?(Client.find(2))
end
+ def test_included_in_collection_for_new_records
+ client = Client.create(:name => 'Persisted')
+ assert_nil client.client_of
+ assert !Firm.new.clients_of_firm.include?(client),
+ 'includes a client that does not belong to any firm'
+ end
+
def test_adding_array_and_collection
assert_nothing_raised { Firm.first.clients + Firm.all.last.clients }
end
Please sign in to comment.
Something went wrong with that request. Please try again.