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.
This commit is contained in:
decabeza
2022-05-04 23:12:53 +02:00
committed by Javi Martín
parent 80bb2f2d97
commit 682781cd3d
2 changed files with 23 additions and 1 deletions

View File

@@ -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

View File

@@ -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