Only show enabled connected app types

The preference will be set from the admin interface in a new commit

It would be nice if we had an array/list type for preferences. Probably not too hard to implement, but this will do.
This commit is contained in:
David Cook
2024-08-01 11:31:09 +10:00
committed by Rachel Arnould
parent fcea437d7e
commit 4223b36bc3
2 changed files with 13 additions and 4 deletions

View File

@@ -1,4 +1,3 @@
= render partial: "/admin/enterprises/form/connected_apps/discover_regen",
locals: { enterprise:, connected_app: enterprise.connected_apps.discover_regen.first }
= render partial: "/admin/enterprises/form/connected_apps/affiliate_sales_data",
locals: { enterprise:, connected_app: enterprise.connected_apps.affiliate_sales_data.first }
- Spree::Config.connected_apps_enabled&.split(',')&.each do |type|
= render partial: "/admin/enterprises/form/connected_apps/#{type}",
locals: { enterprise:, connected_app: enterprise.connected_apps.public_send(type).first }

View File

@@ -42,6 +42,16 @@ RSpec.describe "Connected Apps", feature: :connected_apps, vcr: true do
expect(page).to have_content "CONNECTED APPS"
end
it "only shows enabled apps" do
allow(Spree::Config).to receive(:connected_apps_enabled).and_return("discover_regen")
visit "#{edit_admin_enterprise_path(enterprise)}#/connected_apps_panel"
expect(page).to have_selector "h3", text: "Discover Regenerative"
expect(page).not_to have_selector "h3", text: "INRAE / UFC QUE CHOISIR Research"
end
describe "Discover Regenerative" do
before do
allow(Spree::Config).to receive(:connected_apps_enabled).and_return("discover_regen")