Fix #5347: Don't use exception template for post validation errors
Also fixes #5173: Parenting a post to itself using the "parent id" box leads to an error.
This commit is contained in:
@@ -787,7 +787,7 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
context "update action" do
|
||||
should "work" do
|
||||
should "redirect to the post on success" do
|
||||
put_auth post_path(@post), @user, params: {:post => {:tag_string => "bbb"}}
|
||||
assert_redirected_to post_path(@post)
|
||||
|
||||
@@ -812,6 +812,13 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response 403
|
||||
assert_not_equal("blah", @post.reload.tag_string)
|
||||
end
|
||||
|
||||
should "not raise an exception on validation error" do
|
||||
put_auth post_path(@post), @user, params: { post: { parent_id: @post.id }}
|
||||
assert_redirected_to post_path(@post)
|
||||
|
||||
assert_nil(@post.parent_id)
|
||||
end
|
||||
end
|
||||
|
||||
context "destroy action" do
|
||||
|
||||
Reference in New Issue
Block a user