diff --git a/app/views/admin/enterprises/form/_connected_apps.html.haml b/app/views/admin/enterprises/form/_connected_apps.html.haml index 1c7904b2ed..c4879001ff 100644 --- a/app/views/admin/enterprises/form/_connected_apps.html.haml +++ b/app/views/admin/enterprises/form/_connected_apps.html.haml @@ -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 } diff --git a/spec/system/admin/enterprises/connected_apps_spec.rb b/spec/system/admin/enterprises/connected_apps_spec.rb index 078560b7c3..cba070861e 100644 --- a/spec/system/admin/enterprises/connected_apps_spec.rb +++ b/spec/system/admin/enterprises/connected_apps_spec.rb @@ -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")