From a72c1ec43ea91c1dd9b37870c77e82da7cc2f5d8 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 16 Oct 2007 05:07:58 +0000 Subject: Refactor association create and build so before & after callbacks behave consistently. Closes #8854. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7935 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/associations_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/test/associations_test.rb') diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index 9e4d0f2711..f912816f33 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -595,6 +595,13 @@ class HasManyAssociationsTest < Test::Unit::TestCase end end + def test_create_with_bang_on_has_many_raises_when_record_not_saved + assert_raises(ActiveRecord::RecordInvalid) do + firm = Firm.find(:first) + firm.plain_clients.create! + end + end + def test_create_with_bang_on_habtm_when_parent_is_new_raises assert_raises(ActiveRecord::RecordNotSaved) do Developer.new("name" => "Aredridel").projects.create! -- cgit v1.2.3