Commit ec3f7f54 authored by Justin Ho's avatar Justin Ho

Scope feature flag to group and refactor code

- Add a proper TODO to implement this on the backend
- Scope feature flag to allow use on specific group
- Use stub_feature_flags to test when ff is disabled
parent 117f320f
......@@ -50,8 +50,9 @@ module IntegrationsActions
false
end
# TODO: Use actual integrations on the group / instance level
# To be completed in https://gitlab.com/groups/gitlab-org/-/epics/2430
def project
# TODO: Change to something more meaningful
Project.first
end
......
......@@ -10,11 +10,11 @@ module Groups
private
def integrations_enabled?
Feature.enabled?(:group_level_integrations)
Feature.enabled?(:group_level_integrations, group)
end
def scoped_edit_integration_path(integration)
edit_group_settings_integration_path(@group, integration)
edit_group_settings_integration_path(group, integration)
end
end
end
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe Admin::IntegrationsController do
let_it_be(:project) { create(:project) }
let(:admin) { create(:admin) }
let!(:project) { create(:project) }
before do
sign_in(admin)
......@@ -13,7 +13,7 @@ describe Admin::IntegrationsController do
describe '#edit' do
context 'when instance_level_integrations not enabled' do
it 'returns not_found' do
allow(Feature).to receive(:enabled?).with(:instance_level_integrations) { false }
stub_feature_flags(instance_level_integrations: false)
get :edit, params: { id: Service.available_services_names.sample }
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe Groups::Settings::IntegrationsController do
let_it_be(:project) { create(:project) }
let(:user) { create(:user) }
let(:group) { create(:group) }
let!(:project) { create(:project) }
before do
sign_in(user)
......@@ -14,7 +14,7 @@ describe Groups::Settings::IntegrationsController do
describe '#edit' do
context 'when group_level_integrations not enabled' do
it 'returns not_found' do
allow(Feature).to receive(:enabled?).with(:group_level_integrations) { false }
stub_feature_flags(group_level_integrations: { enabled: false, thing: group })
get :edit, params: { group_id: group, id: Service.available_services_names.sample }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment