diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-10 00:08:32 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-10 00:08:32 +0000 |
commit | 537882ad400c403ff43a5db802f9756cb81286e4 (patch) | |
tree | 26e93ea1985b0f5cdf74eb6e7799eca7faa8e998 /spec/models/group_deploy_key_spec.rb | |
parent | b296ffa543e23f57fa2692539e6f0028c59e2203 (diff) | |
download | gitlab-ce-537882ad400c403ff43a5db802f9756cb81286e4.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/group_deploy_key_spec.rb')
-rw-r--r-- | spec/models/group_deploy_key_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/group_deploy_key_spec.rb b/spec/models/group_deploy_key_spec.rb index 6757c5534ce..dfb4fee593f 100644 --- a/spec/models/group_deploy_key_spec.rb +++ b/spec/models/group_deploy_key_spec.rb @@ -82,4 +82,25 @@ RSpec.describe GroupDeployKey do end end end + + describe '.for_groups' do + context 'when group deploy keys are enabled for some groups' do + let_it_be(:group1) { create(:group) } + let_it_be(:group2) { create(:group) } + let_it_be(:group3) { create(:group) } + let_it_be(:gdk1) { create(:group_deploy_key) } + let_it_be(:gdk2) { create(:group_deploy_key) } + let_it_be(:gdk3) { create(:group_deploy_key) } + + it 'returns these group deploy keys' do + gdk1.groups << group1 + gdk1.groups << group2 + gdk2.groups << group3 + gdk3.groups << group2 + + expect(described_class.for_groups([group1.id, group3.id])).to contain_exactly(gdk1, gdk2) + expect(described_class.for_groups([group2.id])).to contain_exactly(gdk1, gdk3) + end + end + end end |