Fix #5208: The posts version of create or update artist commentary endpoint does not work without the post ID parameter being passed in the body

Fix /posts/:post_id/artist_commentary/create_or_update not working
without passing `artist_commentary[post_id]` in the form body.
This commit is contained in:
evazion
2022-08-25 21:50:33 -05:00
parent 91b3a4c37a
commit 18c949ff34
3 changed files with 16 additions and 5 deletions

View File

@@ -49,7 +49,7 @@ class ArtistCommentariesControllerTest < ActionDispatch::IntegrationTest
params = {
artist_commentary: {
original_title: "foo",
post_id: FactoryBot.create(:post).id
post_id: create(:post).id
},
format: "js"
}
@@ -74,6 +74,19 @@ class ArtistCommentariesControllerTest < ActionDispatch::IntegrationTest
assert_response :success
assert_equal("foo", @commentary.reload.original_title)
end
should "work for /posts/:post_id/artist_commentary/create_or_update" do
params = {
post_id: create(:post).id,
artist_commentary: { original_title: "foo" },
}
assert_difference("ArtistCommentary.count", 1) do
put_auth create_or_update_post_artist_commentary_path(params), @user, xhr: true
end
assert_response :success
end
end
context "revert action" do