Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding a test for create! with invalid associations

  • Loading branch information...
commit 964338777d183fdbf408a09ae6d7426ac8aaf96c 1 parent 0df8830
@tenderlove tenderlove authored
View
9 activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -773,4 +773,13 @@ def test_create_should_not_raise_exception_when_join_record_has_errors
Category.create(:name => 'Fishing', :authors => [Author.first])
end
end
+
+ def test_create_bang_should_raise_exception_when_join_record_has_errors
+ repair_validations(Categorization) do
+ Categorization.validate { |r| r.errors[:base] << 'Invalid Categorization' }
+ assert_raises(ActiveRecord::RecordInvalid) do
+ Category.create!(:name => 'Fishing', :authors => [Author.first])
+ end
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.