Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include machine learning settings type #4827

Merged
merged 2 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def prefix
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
Expand Down
26 changes: 22 additions & 4 deletions spec/system/admin/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@
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"
Expand Down Expand Up @@ -311,7 +310,6 @@
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"
Expand All @@ -321,7 +319,6 @@

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"
Expand All @@ -333,7 +330,6 @@

scenario "is enabled right after enabling the feature" do
Setting["feature.sdg"] = false
login_as(create(:administrator).user)

visit admin_settings_path

Expand All @@ -350,4 +346,26 @@
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