Add new settings tab for participation processes

- Rename setting keys
- New tab por participation processes
- Hide these settings from features tab
This commit is contained in:
Julian Herrero
2019-03-13 12:41:42 +01:00
parent 1ece761beb
commit c82b2a975a
34 changed files with 188 additions and 143 deletions

View File

@@ -17,12 +17,14 @@ feature "Admin feature flags" do
end
end
scenario "Disable a feature" do
setting_id = Setting.find_by(key: "feature.spending_proposals").id
scenario "Disable a participatory process" do
setting = Setting.find_by(key: "process.budgets")
budget = create(:budget)
visit admin_settings_path
within("#settings-tabs") { click_link "Participation processes" }
within("#edit_setting_#{setting_id}") do
within("#edit_setting_#{setting.id}") do
expect(page).to have_button "Disable"
expect(page).not_to have_button "Enable"
click_button "Disable"
@@ -31,28 +33,27 @@ feature "Admin feature flags" do
visit admin_root_path
within("#side_menu") do
expect(page).not_to have_link "Budgets"
expect(page).not_to have_link "Spending proposals"
expect(page).not_to have_link "Participatory budgets"
end
expect{ visit spending_proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
expect{ visit admin_spending_proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
expect{ visit budget_path(budget) }.to raise_exception(FeatureFlags::FeatureDisabled)
expect{ visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
end
scenario "Enable a disabled feature" do
Setting["feature.spending_proposals"] = nil
setting_id = Setting.find_by(key: "feature.spending_proposals").id
scenario "Enable a disabled participatory process" do
Setting["process.budgets"] = nil
setting = Setting.find_by(key: "process.budgets")
visit admin_root_path
within("#side_menu") do
expect(page).not_to have_link "Budgets"
expect(page).not_to have_link "Spending proposals"
expect(page).not_to have_link "Participatory budgets"
end
visit admin_settings_path
within("#settings-tabs") { click_link "Participation processes" }
within("#edit_setting_#{setting_id}") do
within("#edit_setting_#{setting.id}") do
expect(page).to have_button "Enable"
expect(page).not_to have_button "Disable"
click_button "Enable"
@@ -61,7 +62,45 @@ feature "Admin feature flags" do
visit admin_root_path
within("#side_menu") do
expect(page).to have_link "Spending proposals"
expect(page).to have_link "Participatory budgets"
end
end
scenario "Disable a feature" do
setting = Setting.find_by(key: "feature.spending_proposals")
visit admin_settings_path
within("#edit_setting_#{setting.id}") do
expect(page).to have_button "Disable"
expect(page).not_to have_button "Enable"
click_button "Disable"
end
expect(page).to have_content "Value updated"
within("#edit_setting_#{setting.id}") do
expect(page).to have_button "Enable"
expect(page).not_to have_button "Disable"
end
end
scenario "Enable a disabled feature" do
setting = Setting.find_by(key: "feature.map")
visit admin_settings_path
within("#edit_setting_#{setting.id}") do
expect(page).to have_button "Enable"
expect(page).not_to have_button "Disable"
click_button "Enable"
end
expect(page).to have_content "Value updated"
within("#edit_setting_#{setting.id}") do
expect(page).to have_button "Disable"
expect(page).not_to have_button "Enable"
end
end