Bugfix: categories are shown on process update

These changes fix a bug that causes categories
of a legislation process to be wiped on update
of the process. It also adds a regression test
for this fix.
This commit is contained in:
Andrew Sims
2019-11-24 14:01:59 +11:00
parent c3d0e2b917
commit 5d3748d863
2 changed files with 7 additions and 7 deletions

View File

@@ -24,8 +24,6 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
def update
if @process.update(process_params)
set_tag_list
link = legislation_process_path(@process)
redirect_back(fallback_location: (request.referer || root_path),
notice: t("admin.legislation.processes.update.notice", link: link))
@@ -77,11 +75,6 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
]
end
def set_tag_list
@process.set_tag_list_on(:customs, process_params[:custom_list])
@process.save!
end
def resource
@process || ::Legislation::Process.find(params[:id])
end

View File

@@ -249,6 +249,13 @@ describe "Admin collaborative legislation" do
visit admin_legislation_process_proposals_path(process)
expect(page).to have_field("Categories", with: "bicycles, recycling")
within(".admin-content") { click_link "Information" }
fill_in "Summary", with: "Summarizing the process"
click_button "Save changes"
visit admin_legislation_process_proposals_path(process)
expect(page).to have_field("Categories", with: "bicycles, recycling")
end
scenario "Edit milestones summary", :js do