提交 96433877 编写于 作者: A Aaron Patterson

adding a test for create! with invalid associations

上级 0df88301
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册