Fix #4176: Ordering favorite groups errors out.

This commit is contained in:
evazion
2019-09-22 15:19:23 -05:00
parent e98db8a5b8
commit 9839f97f9e
2 changed files with 6 additions and 4 deletions

View File

@@ -74,6 +74,6 @@ class FavoriteGroupsController < ApplicationController
end
def favgroup_params
params.fetch(:favorite_group, {}).permit(%i[name post_ids is_public])
params.fetch(:favorite_group, {}).permit(%i[name post_ids is_public], post_id_array: [])
end
end

View File

@@ -45,11 +45,13 @@ class FavoriteGroupsControllerTest < ActionDispatch::IntegrationTest
end
context "update action" do
should "render" do
params = { favorite_group: { name: "foo" } }
put_auth favorite_group_path(@favgroup), @user, params: params
should "update posts" do
@posts = create_list(:post, 2)
put_auth favorite_group_path(@favgroup), @user, params: { favorite_group: { name: "foo", post_id_array: @posts.map(&:id) } }
assert_redirected_to @favgroup
assert_equal("foo", @favgroup.reload.name)
assert_equal(@posts.map(&:id), @favgroup.post_id_array)
end
end