Fix crash updating legislation process categories

We were expecting translation parameters in legislation processes
`update` action. However, those parameters aren't sent when we get to
that action through the "proposals" tab.
This commit is contained in:
Javi Martín
2018-09-06 13:12:50 +02:00
parent 58ad333791
commit 4d238c5d07
2 changed files with 13 additions and 0 deletions

View File

@@ -8,6 +8,8 @@ module Translatable
private private
def translation_params(resource_model) def translation_params(resource_model)
return [] unless params[:enabled_translations]
resource_model.translated_attribute_names.product(enabled_translations).map do |attr_name, loc| resource_model.translated_attribute_names.product(enabled_translations).map do |attr_name, loc|
resource_model.localized_attr_name_for(attr_name, loc) resource_model.localized_attr_name_for(attr_name, loc)
end end

View File

@@ -130,5 +130,16 @@ feature 'Admin legislation processes' do
expect(page).not_to have_content 'Draft publication' expect(page).not_to have_content 'Draft publication'
end end
scenario "Change proposal categories" do
visit edit_admin_legislation_process_path(process)
within(".admin-content") { click_link "Proposals" }
fill_in "Categories", with: "recycling,bicycles"
click_button "Save changes"
visit admin_legislation_process_proposals_path(process)
expect(page).to have_field("Categories", with: "bicycles, recycling")
end
end end
end end