diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/models/deploy_token_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/models/deploy_token_spec.rb')
-rw-r--r-- | spec/models/deploy_token_spec.rb | 76 |
1 files changed, 31 insertions, 45 deletions
diff --git a/spec/models/deploy_token_spec.rb b/spec/models/deploy_token_spec.rb index c8917a7dd65..dfc37f9e661 100644 --- a/spec/models/deploy_token_spec.rb +++ b/spec/models/deploy_token_spec.rb @@ -248,68 +248,54 @@ RSpec.describe DeployToken do deploy_token.groups << group end - context 'and the allow_group_deploy_token feature flag is turned off' do - it 'is false' do - stub_feature_flags(allow_group_deploy_token: false) - - is_expected.to be_falsy - end + context 'and the passed-in project does not belong to any group' do + it { is_expected.to be_falsy } end - context 'and the allow_group_deploy_token feature flag is turned on' do - before do - stub_feature_flags(allow_group_deploy_token: true) - end + context 'and the passed-in project belongs to the token group' do + it 'is true' do + group.projects << project - context 'and the passed-in project does not belong to any group' do - it { is_expected.to be_falsy } + is_expected.to be_truthy end + end - context 'and the passed-in project belongs to the token group' do - it 'is true' do - group.projects << project + context 'and the passed-in project belongs to a subgroup' do + let(:child_group) { create(:group, parent_id: group.id) } + let(:grandchild_group) { create(:group, parent_id: child_group.id) } - is_expected.to be_truthy - end + before do + grandchild_group.projects << project end - context 'and the passed-in project belongs to a subgroup' do - let(:child_group) { create(:group, parent_id: group.id) } - let(:grandchild_group) { create(:group, parent_id: child_group.id) } - - before do - grandchild_group.projects << project - end - - context 'and the token group is an ancestor (grand-parent) of this group' do - it { is_expected.to be_truthy } - end + context 'and the token group is an ancestor (grand-parent) of this group' do + it { is_expected.to be_truthy } + end - context 'and the token group is not ancestor of this group' do - let(:child2_group) { create(:group, parent_id: group.id) } + context 'and the token group is not ancestor of this group' do + let(:child2_group) { create(:group, parent_id: group.id) } - it 'is false' do - deploy_token.groups = [child2_group] + it 'is false' do + deploy_token.groups = [child2_group] - is_expected.to be_falsey - end + is_expected.to be_falsey end end + end - context 'and the passed-in project does not belong to the token group' do - it { is_expected.to be_falsy } - end + context 'and the passed-in project does not belong to the token group' do + it { is_expected.to be_falsy } + end - context 'and the project belongs to a group that is parent of the token group' do - let(:super_group) { create(:group) } - let(:deploy_token) { create(:deploy_token, :group) } - let(:group) { create(:group, parent_id: super_group.id) } + context 'and the project belongs to a group that is parent of the token group' do + let(:super_group) { create(:group) } + let(:deploy_token) { create(:deploy_token, :group) } + let(:group) { create(:group, parent_id: super_group.id) } - it 'is false' do - super_group.projects << project + it 'is false' do + super_group.projects << project - is_expected.to be_falsey - end + is_expected.to be_falsey end end end |