From 80bb2f2d971aa1a54819bca390d4f8ce0150e845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 5 May 2022 18:10:29 +0200 Subject: [PATCH 1/2] Remove unneeded login in settings specs It looks like these lines were added on a branch which didn't include commit 3da4ee00b but were merged after that commit was merged. In any case, since we're already using the `:admin` tag in the whole file, these lines aren't necessary. --- spec/system/admin/settings_spec.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/system/admin/settings_spec.rb b/spec/system/admin/settings_spec.rb index 8160d4043..d839241d4 100644 --- a/spec/system/admin/settings_spec.rb +++ b/spec/system/admin/settings_spec.rb @@ -264,7 +264,6 @@ describe "Admin settings", :admin do scenario "On #tab-sdg-configuration" do Setting["feature.sdg"] = true Setting.create!(key: "sdg.whatever") - login_as(create(:administrator).user) visit admin_settings_path click_link "SDG configuration" @@ -311,7 +310,6 @@ describe "Admin settings", :admin do describe "SDG configuration tab" do scenario "is enabled when the sdg feature is enabled" do Setting["feature.sdg"] = true - login_as(create(:administrator).user) visit admin_settings_path click_link "SDG configuration" @@ -321,7 +319,6 @@ describe "Admin settings", :admin do scenario "is disabled when the sdg feature is disabled" do Setting["feature.sdg"] = false - login_as(create(:administrator).user) visit admin_settings_path click_link "SDG configuration" @@ -333,7 +330,6 @@ describe "Admin settings", :admin do scenario "is enabled right after enabling the feature" do Setting["feature.sdg"] = false - login_as(create(:administrator).user) visit admin_settings_path From 682781cd3dd2cee86a9d88974ee6856da09bdf4b Mon Sep 17 00:00:00 2001 From: decabeza Date: Wed, 4 May 2022 23:12:53 +0200 Subject: [PATCH 2/2] Include machine learning settings type On the Configuration settings page three settings appeared without description: * Comments Summary: No description. * Related Content: No description. * Tags: No description. These settings are related with the AI / Machine learning feature. They only should appear on AI / Machine learning setting page when the feature is enabled. --- app/models/setting.rb | 2 +- spec/system/admin/settings_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/models/setting.rb b/app/models/setting.rb index a35d8b6c2..45de7d3ea 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -8,7 +8,7 @@ class Setting < ApplicationRecord end def type - if %w[feature process proposals map html homepage uploads sdg].include? prefix + if %w[feature process proposals map html homepage uploads sdg machine_learning].include? prefix prefix elsif %w[remote_census].include? prefix key.rpartition(".").first diff --git a/spec/system/admin/settings_spec.rb b/spec/system/admin/settings_spec.rb index d839241d4..d4af85d41 100644 --- a/spec/system/admin/settings_spec.rb +++ b/spec/system/admin/settings_spec.rb @@ -346,4 +346,26 @@ describe "Admin settings", :admin do expect(page).to have_css "h2", exact_text: "SDG configuration" end end + + describe "Machine learning settings" do + scenario "show the machine learning feature but not its settings" do + Setting["feature.machine_learning"] = true + + visit admin_settings_path + + expect(page).not_to have_content "Machine Learning" + expect(page).not_to have_content "Comments Summary" + expect(page).not_to have_content "Related Content" + expect(page).not_to have_content "Tags" + expect(page).not_to have_css ".translation_missing" + + click_link "Features" + + expect(page).to have_content "Machine Learning" + expect(page).not_to have_content "Comments Summary" + expect(page).not_to have_content "Related Content" + expect(page).not_to have_content "Tags" + expect(page).not_to have_css ".translation_missing" + end + end end