diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-03 03:09:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-03 03:09:53 +0300 |
commit | 1502c20d04c7ff8d719175c76b0a2507ab390172 (patch) | |
tree | dc01bfe0877bd93e7047db28dd972c7d597a527b /spec/helpers/services_helper_spec.rb | |
parent | f96f2720d1b21b76eadedc54fdea67cb70e98d94 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers/services_helper_spec.rb')
-rw-r--r-- | spec/helpers/services_helper_spec.rb | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/spec/helpers/services_helper_spec.rb b/spec/helpers/services_helper_spec.rb index d6b48b3d565..29c83b7c4da 100644 --- a/spec/helpers/services_helper_spec.rb +++ b/spec/helpers/services_helper_spec.rb @@ -59,4 +59,57 @@ RSpec.describe ServicesHelper do end end end + + describe '#scoped_reset_integration_path' do + let(:integration) { build_stubbed(:jira_service) } + let(:group) { nil } + + subject { helper.scoped_reset_integration_path(integration, group: group) } + + context 'when no group is present' do + it 'returns instance-level path' do + is_expected.to eq(reset_admin_application_settings_integration_path(integration)) + end + end + + context 'when group is present' do + let(:group) { build_stubbed(:group) } + + it 'returns group-level path' do + is_expected.to eq(reset_group_settings_integration_path(group, integration)) + end + end + end + + describe '#reset_integrations?' do + let(:group) { nil } + + subject { helper.reset_integrations?(group: group) } + + context 'when `reset_integrations` is not enabled' do + it 'returns false' do + stub_feature_flags(reset_integrations: false) + + is_expected.to eq(false) + end + end + + context 'when `reset_integrations` is enabled' do + it 'returns true' do + stub_feature_flags(reset_integrations: true) + + is_expected.to eq(true) + end + end + + context 'when `reset_integrations` is enabled for a group' do + let(:group) { build_stubbed(:group) } + + it 'returns true' do + stub_feature_flags(reset_integrations: group) + + is_expected.to eq(true) + end + end + end end |