From 0a901cb82f25c95cb59f64d162419b39fdf2410a Mon Sep 17 00:00:00 2001 From: taitus Date: Wed, 10 Apr 2019 14:16:43 +0200 Subject: [PATCH] Enable remote census configuration when remote census is active According to the feature setting["remote_census"]: - Display info to enable tab when remote_census feature is disabled. - Display all related setting to remote_census when feature is enabled --- .../_remote_census_configuration_tab.html.erb | 6 ++++ config/locales/en/admin.yml | 1 + config/locales/es/admin.yml | 1 + spec/features/admin/settings_spec.rb | 29 +++++++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/app/views/admin/settings/_remote_census_configuration_tab.html.erb b/app/views/admin/settings/_remote_census_configuration_tab.html.erb index f16af9d80..c3279ead2 100644 --- a/app/views/admin/settings/_remote_census_configuration_tab.html.erb +++ b/app/views/admin/settings/_remote_census_configuration_tab.html.erb @@ -1,5 +1,11 @@ +<% if feature?(:remote_census) %>

<%= t("admin.settings.index.remote_census.title") %>

<%= render "settings_table", settings: @remote_census_general_settings %> <%= render "settings_table", settings: @remote_census_request_settings %> <%= render "settings_table", settings: @remote_census_response_settings %> +<% else %> +
+ <%= t("admin.settings.index.remote_census.how_to_enable") %> +
+<% end %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 665012c23..22f64ceb9 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -1313,6 +1313,7 @@ en: title: Proposals dashboard remote_census: title: Remote Census configuration + how_to_enable: 'To configure remote census (SOAP) you must enable "Configure connection to remote census (SOAP)" on "Features" tab.' setting: Feature setting_actions: Actions setting_name: Setting diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index bfb52c68f..2e8db77a3 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -1314,6 +1314,7 @@ es: title: Panel de progreso de propuestas remote_census: title: Configuración del Censo Remoto + how_to_enable: 'Para configurar la conexión con el Censo Remoto (SOAP) se debe activar "Configurar la conexión al censo remoto (SOAP)" en la pestaña "Funcionalidades".' setting: Funcionalidad setting_actions: Acciones setting_name: Configuración diff --git a/spec/features/admin/settings_spec.rb b/spec/features/admin/settings_spec.rb index ef72b5d0c..48258242d 100644 --- a/spec/features/admin/settings_spec.rb +++ b/spec/features/admin/settings_spec.rb @@ -132,6 +132,35 @@ describe "Admin settings" do end + describe "Update Remote Census Configuration" do + + scenario "Should not be able when remote census feature deactivated" do + Setting["feature.remote_census"] = nil + admin = create(:administrator).user + login_as(admin) + visit admin_settings_path + find("#remote-census-tab").click + + expect(page).to have_content 'To configure remote census (SOAP) you must enable ' \ + '"Configure connection to remote census (SOAP)" ' \ + 'on "Features" tab.' + end + + scenario "Should be able when remote census feature activated" do + Setting["feature.remote_census"] = true + admin = create(:administrator).user + login_as(admin) + visit admin_settings_path + find("#remote-census-tab").click + + expect(page).not_to have_content 'To configure remote census (SOAP) you must enable ' \ + '"Configure connection to remote census (SOAP)" ' \ + 'on "Features" tab.' + Setting["feature.remote_census"] = nil + end + + end + describe "Skip verification" do scenario "deactivate skip verification", :js do