Commit 9787e5e3 authored by Robert May's avatar Robert May

Merge branch 'justin_ho-enable-slack-application-for-development-environment' into 'master'

Enable Slack application on development

See merge request gitlab-org/gitlab!78576
parents 9bdf73a5 38e7b481
......@@ -22,7 +22,7 @@ module EE
override :project_specific_integration_names
def project_specific_integration_names
integrations = super + EE_PROJECT_SPECIFIC_INTEGRATION_NAMES
integrations += EE_COM_PROJECT_SPECIFIC_INTEGRATION_NAMES if ::Gitlab.com?
integrations += EE_COM_PROJECT_SPECIFIC_INTEGRATION_NAMES if ::Gitlab.dev_env_or_com?
integrations
end
end
......
......@@ -658,7 +658,13 @@ module EE
def disabled_integrations
strong_memoize(:disabled_integrations) do
gh = github_integration_enabled? ? [] : %w[github]
slack = ::Gitlab::CurrentSettings.slack_app_enabled ? %w[slack_slash_commands] : %w[gitlab_slack_application]
slack = if Rails.env.development?
[]
elsif ::Gitlab::CurrentSettings.slack_app_enabled
%w[slack_slash_commands]
else
%w[gitlab_slack_application]
end
super + gh + slack
end
......
......@@ -8,6 +8,8 @@ RSpec.describe Integration do
end
describe '.project_specific_integration_names' do
subject { described_class.project_specific_integration_names }
before do
allow(::Gitlab).to receive(:com?).and_return(com)
end
......@@ -15,19 +17,22 @@ RSpec.describe Integration do
context 'when not on gitlab.com' do
let(:com) { false }
it do
expect(described_class.project_specific_integration_names)
.to include(*described_class::EE_PROJECT_SPECIFIC_INTEGRATION_NAMES)
it { is_expected.to include(*described_class::EE_PROJECT_SPECIFIC_INTEGRATION_NAMES) }
it { is_expected.not_to include(*described_class::EE_COM_PROJECT_SPECIFIC_INTEGRATION_NAMES) }
context 'when on dev' do
before do
allow(Rails.env).to receive(:development?).and_return(true)
end
it { is_expected.to include(*described_class::EE_COM_PROJECT_SPECIFIC_INTEGRATION_NAMES) }
end
end
context 'when on gitlab.com' do
let(:com) { true }
it do
expect(described_class.project_specific_integration_names)
.to include(*described_class::EE_PROJECT_SPECIFIC_INTEGRATION_NAMES, *Integration::EE_COM_PROJECT_SPECIFIC_INTEGRATION_NAMES)
end
it { is_expected.to include(*described_class::EE_PROJECT_SPECIFIC_INTEGRATION_NAMES, *Integration::EE_COM_PROJECT_SPECIFIC_INTEGRATION_NAMES) }
end
end
......
......@@ -1729,22 +1729,42 @@ RSpec.describe Project do
subject { project.disabled_integrations }
where(:license_feature, :disabled_integrations) do
:github_project_service_integration | %w[github]
end
context 'github' do
where(:license_feature, :disabled_integrations) do
:github_project_service_integration | %w[github]
end
with_them do
context 'when feature is available' do
before do
stub_licensed_features(license_feature => true)
with_them do
context 'when feature is available' do
before do
stub_licensed_features(license_feature => true)
end
it { is_expected.not_to include(*disabled_integrations) }
end
it { is_expected.not_to include(*disabled_integrations) }
context 'when feature is unavailable' do
before do
stub_licensed_features(license_feature => false)
end
it { is_expected.to include(*disabled_integrations) }
end
end
end
context 'slack' do
where(:development, :slack_app_enabled, :disabled_integrations) do
true | true | []
true | false | []
false | true | %w[slack_slash_commands]
false | false | %w[gitlab_slack_application]
end
context 'when feature is unavailable' do
with_them do
before do
stub_licensed_features(license_feature => false)
allow(Rails.env).to receive(:development?).and_return(development)
allow(Gitlab::CurrentSettings).to receive(:slack_app_enabled).and_return(slack_app_enabled)
end
it { is_expected.to include(*disabled_integrations) }
......
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