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:
@@ -4,6 +4,7 @@ class Admin::SettingsController < Admin::BaseController
|
||||
all_settings = Setting.all.group_by { |setting| setting.type }
|
||||
@configuration_settings = all_settings["configuration"]
|
||||
@feature_settings = all_settings["feature"]
|
||||
@participation_processes_settings = all_settings["process"]
|
||||
@map_configuration_settings = all_settings["map"]
|
||||
end
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ module FeatureFlags
|
||||
end
|
||||
|
||||
def check_feature_flag(name)
|
||||
raise FeatureDisabled, name unless Setting["feature.#{name}"]
|
||||
raise FeatureDisabled, name unless Setting["feature.#{name}"] || Setting["process.#{name}"]
|
||||
end
|
||||
|
||||
class FeatureDisabled < Exception
|
||||
|
||||
@@ -14,8 +14,8 @@ class UsersController < ApplicationController
|
||||
def set_activity_counts
|
||||
@activity_counts = HashWithIndifferentAccess.new(
|
||||
proposals: Proposal.where(author_id: @user.id).count,
|
||||
debates: (Setting["feature.debates"] ? Debate.where(author_id: @user.id).count : 0),
|
||||
budget_investments: (Setting["feature.budgets"] ? Budget::Investment.where(author_id: @user.id).count : 0),
|
||||
debates: (Setting["process.debates"] ? Debate.where(author_id: @user.id).count : 0),
|
||||
budget_investments: (Setting["process.budgets"] ? Budget::Investment.where(author_id: @user.id).count : 0),
|
||||
comments: only_active_commentables.count,
|
||||
follows: @user.follows.map(&:followable).compact.count)
|
||||
end
|
||||
@@ -93,8 +93,8 @@ class UsersController < ApplicationController
|
||||
|
||||
def only_active_commentables
|
||||
disabled_commentables = []
|
||||
disabled_commentables << "Debate" unless Setting["feature.debates"]
|
||||
disabled_commentables << "Budget::Investment" unless Setting["feature.budgets"]
|
||||
disabled_commentables << "Debate" unless Setting["process.debates"]
|
||||
disabled_commentables << "Budget::Investment" unless Setting["process.budgets"]
|
||||
if disabled_commentables.present?
|
||||
all_user_comments.where("commentable_type NOT IN (?)", disabled_commentables)
|
||||
else
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module SettingsHelper
|
||||
|
||||
def feature?(name)
|
||||
setting["feature.#{name}"].presence
|
||||
setting["feature.#{name}"].presence || setting["process.#{name}"].presence
|
||||
end
|
||||
|
||||
def setting
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="tabs-title">
|
||||
<%= link_to "#tab-participation-processes" do %>
|
||||
<%= t("admin.settings.index.participation_processes") %>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="tabs-title" id="features-tab">
|
||||
<%= link_to "#tab-feature-flags" do %>
|
||||
<%= t("admin.settings.index.feature_flags") %>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<h2><%= t("admin.settings.index.participation_processes") %></h2>
|
||||
|
||||
<%= render "featured_settings_table", features: @participation_processes_settings %>
|
||||
@@ -6,6 +6,10 @@
|
||||
<%= render "configuration_settings_tab" %>
|
||||
</div>
|
||||
|
||||
<div class="tabs-panel" id="tab-participation-processes">
|
||||
<%= render "participation_processes_tab" %>
|
||||
</div>
|
||||
|
||||
<div class="tabs-panel" id="tab-feature-flags">
|
||||
<%= render "features_tab" %>
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<%= link_to t("management.menu.support_proposals"), management_proposals_path %>
|
||||
</li>
|
||||
|
||||
<% if Setting["feature.budgets"] %>
|
||||
<% if Setting["process.budgets"] %>
|
||||
<li <%= "class=is-active" if menu_create_investments? %>>
|
||||
<%= link_to t("management.menu.create_budget_investment"), create_investments_management_budgets_path %>
|
||||
</li>
|
||||
@@ -42,7 +42,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<% if Setting["feature.budgets"] %>
|
||||
<% if Setting["process.budgets"] %>
|
||||
<li <%= "class=is-active" if menu_print_investments? %>>
|
||||
<%= link_to print_investments_management_budgets_path do %>
|
||||
<span class="icon-print"></span>
|
||||
|
||||
@@ -1175,6 +1175,7 @@ en:
|
||||
index:
|
||||
title: Configuration settings
|
||||
update_setting: Update
|
||||
participation_processes: "Participation processes"
|
||||
feature_flags: Features
|
||||
features:
|
||||
enabled: "Feature enabled"
|
||||
|
||||
@@ -70,26 +70,16 @@ en:
|
||||
direct_message_max_per_day: "Direct Message max number per day"
|
||||
direct_message_max_per_day_description: "Number max of direct messages one user can send per day"
|
||||
feature:
|
||||
budgets: "Participatory budgeting"
|
||||
budgets_description: "With participatory budgets, citizens decide which projects presented by their neighbours will receive a part of the budget"
|
||||
twitter_login: "Twitter login"
|
||||
twitter_login_description: "Allow users to sign up with their Twitter account"
|
||||
facebook_login: "Facebook login"
|
||||
facebook_login_description: "Allow users to sign up with their Facebook account"
|
||||
google_login: "Google login"
|
||||
google_login_description: "Allow users to sign up with their Google Account"
|
||||
proposals: "Proposals"
|
||||
proposals_description: "Citizens' proposals are an opportunity for neighbours and collectives to decide directly how they want their society to be, after getting sufficient support and submitting to a citizens' vote"
|
||||
featured_proposals: "Featured proposals"
|
||||
featured_proposals_description: "Shows featured proposals on index proposals page"
|
||||
debates: "Debates"
|
||||
debates_description: "The citizens' debate space is aimed at anyone who can present issues that concern them and about which they want to share their views with others"
|
||||
polls: "Polls"
|
||||
polls_description: "Citizens' polls are a participatory mechanism by which citizens with voting rights can make direct decisions"
|
||||
signature_sheets: "Signature sheets"
|
||||
signature_sheets_description: "It allows adding from the Administration panel signatures collected on-site to Proposals and investment projects of the Participative Budgets"
|
||||
legislation: "Collaborative Legislation"
|
||||
legislation_description: "In participatory processes, citizens are offered the opportunity to participate in the drafting and modification of regulations and to give their opinion on certain actions that are planned to be carried out"
|
||||
spending_proposals: "Spending proposals"
|
||||
spending_proposals_description: "⚠️ NOTE: This functionality has been replaced by Participatory Budgeting and will disappear in new versions"
|
||||
spending_proposal_features:
|
||||
@@ -125,3 +115,14 @@ en:
|
||||
longitude_description: "Longitude to show the position of the map"
|
||||
zoom: "Zoom"
|
||||
zoom_description: "Zoom to show the map position"
|
||||
process:
|
||||
debates: "Debates"
|
||||
debates_description: "The citizens' debate space is aimed at anyone who can present issues that concern them and about which they want to share their views with others"
|
||||
proposals: "Proposals"
|
||||
proposals_description: "Citizens' proposals are an opportunity for neighbours and collectives to decide directly how they want their society to be, after getting sufficient support and submitting to a citizens' vote"
|
||||
polls: "Polls"
|
||||
polls_description: "Citizens' polls are a participatory mechanism by which citizens with voting rights can make direct decisions"
|
||||
budgets: "Participatory budgeting"
|
||||
budgets_description: "With participatory budgets, citizens decide which projects presented by their neighbours will receive a part of the budget"
|
||||
legislation: "Legislation"
|
||||
legislation_description: "In participatory processes, citizens are offered the opportunity to participate in the drafting and modification of regulations that affect the society and to give their opinion on certain actions that are planned to be carried out"
|
||||
|
||||
@@ -1174,6 +1174,7 @@ es:
|
||||
index:
|
||||
title: Configuración global
|
||||
update_setting: Actualizar
|
||||
participation_processes: "Procesos de participación"
|
||||
feature_flags: Funcionalidades
|
||||
features:
|
||||
enabled: "Funcionalidad activada"
|
||||
|
||||
@@ -70,26 +70,16 @@ es:
|
||||
direct_message_max_per_day: "Mensajes directos máximos por día"
|
||||
direct_message_max_per_day_description: "Número de mensajes directos máximos que un usuario puede enviar por día"
|
||||
feature:
|
||||
budgets: "Presupuestos participativos"
|
||||
budgets_description: "Con los presupuestos participativos la ciudadanía decide a qué proyectos presentados por los vecinos y vecinas va destinada una parte del presupuesto"
|
||||
twitter_login: "Registro con Twitter"
|
||||
twitter_login_description: "Permitir que los usuarios se registren con su cuenta de Twitter"
|
||||
facebook_login: "Registro con Facebook"
|
||||
facebook_login_description: "Permitir que los usuarios se registren con su cuenta de Facebook"
|
||||
google_login: "Registro con Google"
|
||||
google_login_description: "Permitir que los usuarios se registren con su cuenta de Google"
|
||||
proposals: "Propuestas"
|
||||
proposals_description: "Las propuestas ciudadanas son una oportunidad para que los vecinos y colectivos decidan directamente cómo quieren que sea su sociedad, después de conseguir los apoyos suficientes y de someterse a votación ciudadana"
|
||||
featured_proposals: "Propuestas destacadas"
|
||||
featured_proposals_description: "Muestra propuestas destacadas en la página principal de propuestas"
|
||||
debates: "Debates"
|
||||
debates_description: "El espacio de debates ciudadanos está dirigido a que cualquier persona pueda exponer temas que le preocupan y sobre los que quiera compartir puntos de vista con otras personas"
|
||||
polls: "Votaciones"
|
||||
polls_description: "Las votaciones ciudadanas son un mecanismo de participación por el que la ciudadanía con derecho a voto puede tomar decisiones de forma directa"
|
||||
signature_sheets: "Hojas de firmas"
|
||||
signature_sheets_description: "Permite añadir desde el panel de Administración firmas recogidas de forma presencial a Propuestas y proyectos de gasto de los Presupuestos participativos"
|
||||
legislation: "Legislación colaborativa"
|
||||
legislation_description: "En los procesos participativos se ofrece a la ciudadanía la oportunidad de participar en la elaboración y modificación de normativa y de dar su opinión sobre ciertas actuaciones que se tiene previsto llevar a cabo"
|
||||
spending_proposals: "Propuestas de inversión"
|
||||
spending_proposals_description: "⚠️ NOTA: Esta funcionalidad ha sido sustituida por Pesupuestos Participativos y desaparecerá en nuevas versiones"
|
||||
spending_proposal_features:
|
||||
@@ -125,3 +115,14 @@ es:
|
||||
longitude_description: "Longitud para mostrar la posición del mapa"
|
||||
zoom: "Zoom"
|
||||
zoom_description: "Zoom para mostrar la posición del mapa"
|
||||
process:
|
||||
debates: "Debates"
|
||||
debates_description: "El espacio de debates ciudadanos está dirigido a que cualquier persona pueda exponer temas que le preocupan y sobre los que quiera compartir puntos de vista con otras personas"
|
||||
proposals: "Propuestas"
|
||||
proposals_description: "Las propuestas ciudadanas son una oportunidad para que los vecinos y colectivos decidan directamente cómo quieren que sea su sociedad, después de conseguir los apoyos suficientes y de someterse a votación ciudadana"
|
||||
polls: "Votaciones"
|
||||
polls_description: "Las votaciones ciudadanas son un mecanismo de participación por el que la ciudadanía con derecho a voto puede tomar decisiones de forma directa"
|
||||
budgets: "Presupuestos participativos"
|
||||
budgets_description: "Con los presupuestos participativos la ciudadanía decide a qué proyectos presentados por los vecinos y vecinas va destinada una parte del presupuesto"
|
||||
legislation: "Legislación"
|
||||
legislation_description: "En los procesos participativos se ofrece a la ciudadanía la oportunidad de participar en la elaboración y modificación de normativa que afecta a la sociedad y de dar su opinión sobre ciertas actuaciones que se tiene previsto llevar a cabo"
|
||||
|
||||
@@ -26,18 +26,20 @@ section "Creating Settings" do
|
||||
Setting.create(key: "url", value: "http://localhost:3000")
|
||||
Setting.create(key: "org_name", value: "CONSUL")
|
||||
|
||||
Setting.create(key: "feature.debates", value: "true")
|
||||
Setting.create(key: "feature.proposals", value: "true")
|
||||
Setting.create(key: "feature.featured_proposals", value: nil)
|
||||
Setting.create(key: "feature.polls", value: "true")
|
||||
Setting.create(key: "process.debates", value: "true")
|
||||
Setting.create(key: "process.proposals", value: "true")
|
||||
Setting.create(key: "process.polls", value: "true")
|
||||
Setting.create(key: "process.budgets", value: "true")
|
||||
Setting.create(key: "process.legislation", value: "true")
|
||||
|
||||
Setting.create(key: "feature.featured_proposals", value: "true")
|
||||
Setting.create(key: "feature.spending_proposals", value: nil)
|
||||
Setting.create(key: "feature.spending_proposal_features.voting_allowed", value: nil)
|
||||
Setting.create(key: "feature.budgets", value: "true")
|
||||
|
||||
Setting.create(key: "feature.twitter_login", value: "true")
|
||||
Setting.create(key: "feature.facebook_login", value: "true")
|
||||
Setting.create(key: "feature.google_login", value: "true")
|
||||
Setting.create(key: "feature.signature_sheets", value: "true")
|
||||
Setting.create(key: "feature.legislation", value: "true")
|
||||
Setting.create(key: "feature.user.recommendations", value: "true")
|
||||
Setting.create(key: "feature.user.recommendations_on_debates", value: "true")
|
||||
Setting.create(key: "feature.user.recommendations_on_proposals", value: "true")
|
||||
|
||||
12
db/seeds.rb
12
db/seeds.rb
@@ -65,19 +65,21 @@ Setting["meta_title"] = nil
|
||||
Setting["meta_description"] = nil
|
||||
Setting["meta_keywords"] = nil
|
||||
|
||||
# Processes
|
||||
Setting["process.debates"] = true
|
||||
Setting["process.proposals"] = true
|
||||
Setting["process.polls"] = true
|
||||
Setting["process.budgets"] = true
|
||||
Setting["process.legislation"] = true
|
||||
|
||||
# Feature flags
|
||||
Setting["feature.debates"] = true
|
||||
Setting["feature.proposals"] = true
|
||||
Setting["feature.featured_proposals"] = nil
|
||||
Setting["feature.spending_proposals"] = nil
|
||||
Setting["feature.polls"] = true
|
||||
Setting["feature.twitter_login"] = true
|
||||
Setting["feature.facebook_login"] = true
|
||||
Setting["feature.google_login"] = true
|
||||
Setting["feature.public_stats"] = true
|
||||
Setting["feature.budgets"] = true
|
||||
Setting["feature.signature_sheets"] = true
|
||||
Setting["feature.legislation"] = true
|
||||
Setting["feature.user.recommendations"] = true
|
||||
Setting["feature.user.recommendations_on_debates"] = true
|
||||
Setting["feature.user.recommendations_on_proposals"] = true
|
||||
|
||||
@@ -17,11 +17,11 @@ feature "Admin budget groups" do
|
||||
context "Feature flag" do
|
||||
|
||||
background do
|
||||
Setting["feature.budgets"] = nil
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.budgets"] = true
|
||||
Setting["process.budgets"] = true
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
|
||||
@@ -18,11 +18,11 @@ feature "Admin budget headings" do
|
||||
context "Feature flag" do
|
||||
|
||||
background do
|
||||
Setting["feature.budgets"] = nil
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.budgets"] = true
|
||||
Setting["process.budgets"] = true
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
|
||||
@@ -19,11 +19,11 @@ feature "Admin budget investments" do
|
||||
context "Feature flag" do
|
||||
|
||||
background do
|
||||
Setting["feature.budgets"] = nil
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
|
||||
after do
|
||||
Setting["feature.budgets"] = true
|
||||
Setting["process.budgets"] = true
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require 'rails_helper'
|
||||
require "rails_helper"
|
||||
|
||||
feature 'Admin budgets' do
|
||||
feature "Admin budgets" do
|
||||
|
||||
background do
|
||||
admin = create(:administrator)
|
||||
@@ -12,31 +12,27 @@ feature 'Admin budgets' do
|
||||
"edit_admin_budget_path",
|
||||
%w[name]
|
||||
|
||||
context 'Feature flag' do
|
||||
context "Feature flag" do
|
||||
|
||||
background do
|
||||
Setting['feature.budgets'] = nil
|
||||
Setting["process.budgets"] = nil
|
||||
end
|
||||
|
||||
after do
|
||||
Setting['feature.budgets'] = true
|
||||
end
|
||||
|
||||
scenario 'Disabled with a feature flag' do
|
||||
scenario "Disabled with a feature flag" do
|
||||
expect{ visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'Index' do
|
||||
context "Index" do
|
||||
|
||||
scenario 'Displaying no open budgets text' do
|
||||
scenario "Displaying no open budgets text" do
|
||||
visit admin_budgets_path
|
||||
|
||||
expect(page).to have_content("There are no budgets.")
|
||||
end
|
||||
|
||||
scenario 'Displaying budgets' do
|
||||
scenario "Displaying budgets" do
|
||||
budget = create(:budget)
|
||||
visit admin_budgets_path
|
||||
|
||||
@@ -44,7 +40,7 @@ feature 'Admin budgets' do
|
||||
expect(page).to have_content(translated_phase_name(phase_kind: budget.phase))
|
||||
end
|
||||
|
||||
scenario 'Filters by phase' do
|
||||
scenario "Filters by phase" do
|
||||
drafting_budget = create(:budget, :drafting)
|
||||
accepting_budget = create(:budget, :accepting)
|
||||
selecting_budget = create(:budget, :selecting)
|
||||
@@ -58,14 +54,14 @@ feature 'Admin budgets' do
|
||||
expect(page).to have_content(balloting_budget.name)
|
||||
expect(page).not_to have_content(finished_budget.name)
|
||||
|
||||
click_link 'Finished'
|
||||
click_link "Finished"
|
||||
expect(page).not_to have_content(drafting_budget.name)
|
||||
expect(page).not_to have_content(accepting_budget.name)
|
||||
expect(page).not_to have_content(selecting_budget.name)
|
||||
expect(page).not_to have_content(balloting_budget.name)
|
||||
expect(page).to have_content(finished_budget.name)
|
||||
|
||||
click_link 'Open'
|
||||
click_link "Open"
|
||||
expect(page).to have_content(drafting_budget.name)
|
||||
expect(page).to have_content(accepting_budget.name)
|
||||
expect(page).to have_content(selecting_budget.name)
|
||||
@@ -73,8 +69,8 @@ feature 'Admin budgets' do
|
||||
expect(page).not_to have_content(finished_budget.name)
|
||||
end
|
||||
|
||||
scenario 'Open filter is properly highlighted' do
|
||||
filters_links = {'current' => 'Open', 'finished' => 'Finished'}
|
||||
scenario "Open filter is properly highlighted" do
|
||||
filters_links = {"current" => "Open", "finished" => "Finished"}
|
||||
|
||||
visit admin_budgets_path
|
||||
|
||||
@@ -94,26 +90,26 @@ feature 'Admin budgets' do
|
||||
|
||||
end
|
||||
|
||||
context 'New' do
|
||||
context "New" do
|
||||
|
||||
scenario 'Create budget' do
|
||||
scenario "Create budget" do
|
||||
visit admin_budgets_path
|
||||
click_link 'Create new budget'
|
||||
click_link "Create new budget"
|
||||
|
||||
fill_in "Name", with: "M30 - Summer campaign"
|
||||
select 'Accepting projects', from: 'budget[phase]'
|
||||
select "Accepting projects", from: "budget[phase]"
|
||||
|
||||
click_button 'Create Budget'
|
||||
click_button "Create Budget"
|
||||
|
||||
expect(page).to have_content 'New participatory budget created successfully!'
|
||||
expect(page).to have_content 'M30 - Summer campaign'
|
||||
expect(page).to have_content "New participatory budget created successfully!"
|
||||
expect(page).to have_content "M30 - Summer campaign"
|
||||
end
|
||||
|
||||
scenario 'Name is mandatory' do
|
||||
scenario "Name is mandatory" do
|
||||
visit new_admin_budget_path
|
||||
click_button 'Create Budget'
|
||||
click_button "Create Budget"
|
||||
|
||||
expect(page).not_to have_content 'New participatory budget created successfully!'
|
||||
expect(page).not_to have_content "New participatory budget created successfully!"
|
||||
expect(page).to have_css("label.error", text: "Name")
|
||||
end
|
||||
|
||||
@@ -131,44 +127,44 @@ feature 'Admin budgets' do
|
||||
|
||||
end
|
||||
|
||||
context 'Destroy' do
|
||||
context "Destroy" do
|
||||
|
||||
let!(:budget) { create(:budget) }
|
||||
let(:heading) { create(:budget_heading, group: create(:budget_group, budget: budget)) }
|
||||
|
||||
scenario 'Destroy a budget without investments' do
|
||||
scenario "Destroy a budget without investments" do
|
||||
visit admin_budgets_path
|
||||
click_link 'Edit budget'
|
||||
click_link 'Delete budget'
|
||||
click_link "Edit budget"
|
||||
click_link "Delete budget"
|
||||
|
||||
expect(page).to have_content('Budget deleted successfully')
|
||||
expect(page).to have_content("Budget deleted successfully")
|
||||
expect(page).to have_content("There are no budgets.")
|
||||
end
|
||||
|
||||
scenario 'Try to destroy a budget with investments' do
|
||||
scenario "Try to destroy a budget with investments" do
|
||||
create(:budget_investment, heading: heading)
|
||||
|
||||
visit admin_budgets_path
|
||||
click_link 'Edit budget'
|
||||
click_link 'Delete budget'
|
||||
click_link "Edit budget"
|
||||
click_link "Delete budget"
|
||||
|
||||
expect(page).to have_content('You cannot destroy a Budget that has associated investments')
|
||||
expect(page).to have_content('There is 1 budget')
|
||||
expect(page).to have_content("You cannot destroy a Budget that has associated investments")
|
||||
expect(page).to have_content("There is 1 budget")
|
||||
end
|
||||
end
|
||||
|
||||
context 'Edit' do
|
||||
context "Edit" do
|
||||
let!(:budget) { create(:budget) }
|
||||
|
||||
scenario 'Show phases table' do
|
||||
scenario "Show phases table" do
|
||||
budget.update(phase: "selecting")
|
||||
|
||||
visit admin_budgets_path
|
||||
click_link 'Edit budget'
|
||||
click_link "Edit budget"
|
||||
|
||||
expect(page).to have_select("budget_phase", selected: "Selecting projects")
|
||||
|
||||
within '#budget-phases-table' do
|
||||
within "#budget-phases-table" do
|
||||
|
||||
Budget::Phase::PHASE_KINDS.each do |phase_kind|
|
||||
phase_index = Budget::Phase::PHASE_KINDS.index(phase_kind)
|
||||
@@ -184,9 +180,9 @@ feature 'Admin budgets' do
|
||||
within "#budget_phase_#{phase.id}" do
|
||||
expect(page).to have_content(translated_phase_name(phase_kind: phase.kind))
|
||||
expect(page).to have_content("#{phase.starts_at.to_date} - #{phase.ends_at.to_date}")
|
||||
expect(page).to have_css('.budget-phase-enabled.enabled')
|
||||
expect(page).to have_link('Edit phase', href: edit_phase_link)
|
||||
expect(page).to have_content('Active') if budget.current_phase == phase
|
||||
expect(page).to have_css(".budget-phase-enabled.enabled")
|
||||
expect(page).to have_link("Edit phase", href: edit_phase_link)
|
||||
expect(page).to have_content("Active") if budget.current_phase == phase
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -218,20 +214,20 @@ feature 'Admin budgets' do
|
||||
|
||||
end
|
||||
|
||||
context 'Update' do
|
||||
context "Update" do
|
||||
|
||||
background do
|
||||
create(:budget)
|
||||
end
|
||||
|
||||
scenario 'Update budget' do
|
||||
scenario "Update budget" do
|
||||
visit admin_budgets_path
|
||||
click_link 'Edit budget'
|
||||
click_link "Edit budget"
|
||||
|
||||
fill_in "Name", with: "More trees on the streets"
|
||||
click_button 'Update Budget'
|
||||
click_button "Update Budget"
|
||||
|
||||
expect(page).to have_content('More trees on the streets')
|
||||
expect(page).to have_content("More trees on the streets")
|
||||
expect(page).to have_current_path(admin_budgets_path)
|
||||
end
|
||||
|
||||
@@ -239,8 +235,8 @@ feature 'Admin budgets' do
|
||||
|
||||
context "Calculate Budget's Winner Investments" do
|
||||
|
||||
scenario 'For a Budget in reviewing balloting', :js do
|
||||
budget = create(:budget, phase: 'reviewing_ballots')
|
||||
scenario "For a Budget in reviewing balloting", :js do
|
||||
budget = create(:budget, phase: "reviewing_ballots")
|
||||
group = create(:budget_group, budget: budget)
|
||||
heading = create(:budget_heading, group: group, price: 4)
|
||||
unselected = create(:budget_investment, :unselected, heading: heading, price: 1,
|
||||
@@ -250,16 +246,16 @@ feature 'Admin budgets' do
|
||||
selected = create(:budget_investment, :selected, heading: heading, price: 2, ballot_lines_count: 1)
|
||||
|
||||
visit edit_admin_budget_path(budget)
|
||||
expect(page).not_to have_content 'See results'
|
||||
click_link 'Calculate Winner Investments'
|
||||
expect(page).to have_content 'Winners being calculated, it may take a minute.'
|
||||
expect(page).not_to have_content "See results"
|
||||
click_link "Calculate Winner Investments"
|
||||
expect(page).to have_content "Winners being calculated, it may take a minute."
|
||||
expect(page).to have_content winner.title
|
||||
expect(page).not_to have_content unselected.title
|
||||
expect(page).not_to have_content selected.title
|
||||
|
||||
|
||||
visit edit_admin_budget_path(budget)
|
||||
expect(page).to have_content 'See results'
|
||||
expect(page).to have_content "See results"
|
||||
end
|
||||
|
||||
scenario "For a finished Budget" do
|
||||
|
||||
@@ -3,13 +3,13 @@ require "rails_helper"
|
||||
feature "Admin debates" do
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.debates"] = nil
|
||||
Setting["process.debates"] = nil
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
|
||||
expect{ visit admin_debates_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
|
||||
Setting["feature.debates"] = true
|
||||
Setting["process.debates"] = true
|
||||
end
|
||||
|
||||
background do
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -12,11 +12,9 @@ feature "Admin hidden budget investments" do
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.budgets"] = nil
|
||||
Setting["process.budgets"] = nil
|
||||
|
||||
expect{ visit admin_hidden_budget_investments_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
|
||||
Setting["feature.budgets"] = true
|
||||
end
|
||||
|
||||
scenario "List shows all relevant info" do
|
||||
|
||||
@@ -8,13 +8,11 @@ feature "Admin hidden proposals" do
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.proposals"] = nil
|
||||
Setting["process.proposals"] = nil
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
|
||||
expect{ visit admin_hidden_proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
|
||||
Setting["feature.proposals"] = true
|
||||
end
|
||||
|
||||
scenario "List shows all relevant info" do
|
||||
|
||||
@@ -16,7 +16,7 @@ feature "Admin legislation draft versions" do
|
||||
context "Feature flag" do
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.legislation"] = nil
|
||||
Setting["process.legislation"] = nil
|
||||
process = create(:legislation_process)
|
||||
expect{ visit admin_legislation_process_draft_versions_path(process) }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ feature "Admin collaborative legislation" do
|
||||
context "Feature flag" do
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.legislation"] = nil
|
||||
Setting["process.legislation"] = nil
|
||||
expect{ visit admin_legislation_processes_path }
|
||||
.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
end
|
||||
|
||||
@@ -17,7 +17,7 @@ feature "Admin legislation questions" do
|
||||
context "Feature flag" do
|
||||
|
||||
background do
|
||||
Setting["feature.legislation"] = nil
|
||||
Setting["process.legislation"] = nil
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
|
||||
@@ -4,9 +4,8 @@ require "rails_helper"
|
||||
feature "Debates" do
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.debates"] = nil
|
||||
Setting["process.debates"] = nil
|
||||
expect{ visit debates_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
Setting["feature.debates"] = true
|
||||
end
|
||||
|
||||
context "Concerns" do
|
||||
|
||||
@@ -380,7 +380,7 @@ feature "Emails" do
|
||||
context "Budgets" do
|
||||
|
||||
background do
|
||||
Setting["feature.budgets"] = true
|
||||
Setting["process.budgets"] = true
|
||||
end
|
||||
|
||||
let(:author) { create(:user, :level_two) }
|
||||
|
||||
@@ -12,7 +12,7 @@ feature "Moderate budget investments" do
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.budgets"] = nil
|
||||
Setting["process.budgets"] = nil
|
||||
login_as(@mod.user)
|
||||
|
||||
expect{ visit moderation_budget_investments_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
|
||||
@@ -3,13 +3,11 @@ require "rails_helper"
|
||||
feature "Moderate debates" do
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.debates"] = nil
|
||||
Setting["process.debates"] = nil
|
||||
moderator = create(:moderator)
|
||||
login_as(moderator.user)
|
||||
|
||||
expect{ visit moderation_debates_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
|
||||
Setting["feature.debates"] = true
|
||||
end
|
||||
|
||||
scenario "Hide", :js do
|
||||
|
||||
@@ -3,13 +3,11 @@ require "rails_helper"
|
||||
feature "Moderate proposals" do
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.proposals"] = nil
|
||||
Setting["process.proposals"] = nil
|
||||
moderator = create(:moderator)
|
||||
login_as(moderator.user)
|
||||
|
||||
expect{ visit moderation_proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
|
||||
Setting["feature.proposals"] = true
|
||||
end
|
||||
|
||||
scenario "Hide", :js do
|
||||
|
||||
@@ -8,9 +8,8 @@ feature "Proposals" do
|
||||
"proposal_path"
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.proposals"] = nil
|
||||
Setting["process.proposals"] = nil
|
||||
expect{ visit proposals_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
Setting["feature.proposals"] = true
|
||||
end
|
||||
|
||||
context "Concerns" do
|
||||
|
||||
@@ -409,11 +409,11 @@ feature "Users" do
|
||||
visit user_path(user)
|
||||
expect(page).to have_content("7 Comments")
|
||||
|
||||
Setting["feature.debates"] = nil
|
||||
Setting["process.debates"] = nil
|
||||
visit user_path(user)
|
||||
expect(page).to have_content("6 Comments")
|
||||
|
||||
Setting["feature.budgets"] = nil
|
||||
Setting["process.budgets"] = nil
|
||||
visit user_path(user)
|
||||
expect(page).to have_content("4 Comments")
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ feature "Valuation budget investments" do
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.budgets"] = nil
|
||||
Setting["process.budgets"] = nil
|
||||
expect{
|
||||
visit valuation_budget_budget_investments_path(create(:budget))
|
||||
}.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
|
||||
@@ -8,10 +8,8 @@ feature "Valuation budgets" do
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["feature.budgets"] = nil
|
||||
Setting["process.budgets"] = nil
|
||||
expect{ visit valuation_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled)
|
||||
|
||||
Setting["feature.budgets"] = true
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
Reference in New Issue
Block a user