diff options
author | James Lopez <james@gitlab.com> | 2019-05-02 09:35:06 +0300 |
---|---|---|
committer | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-06-03 15:59:50 +0300 |
commit | 2718721b5c3243e2d6efbbe43159340169625c2a (patch) | |
tree | 9fb66caaae266ed7500dc22e020eaac80cd42d08 /spec | |
parent | 58854b7741f06e16c1687f68300a598ec87c9962 (diff) |
Merge branch 'sh-allow-equal-level-in-subgroup-membership' into 'master'
Allow a member to have an access level equal to parent group
Closes gitlab-ee#11323
See merge request gitlab-org/gitlab-ce!27913
(cherry picked from commit 2b3b0bb1847e5d910b3e5dc5e151f194c12d3907)
32ddc3fe Allow a member to have an access level equal to parent group
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/member_spec.rb | 10 | ||||
-rw-r--r-- | spec/requests/api/members_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/shared_examples/models/member_shared_examples.rb | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index c68c3ce2abe..782a84f922b 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -70,6 +70,16 @@ describe Member do expect(child_member).not_to be_valid end + # Membership in a subgroup confers certain access rights, such as being + # able to merge or push code to protected branches. + it "is valid with an equal level" do + child_member.access_level = GroupMember::DEVELOPER + + child_member.validate + + expect(child_member).to be_valid + end + it "is valid with a higher level" do child_member.access_level = GroupMember::MAINTAINER diff --git a/spec/requests/api/members_spec.rb b/spec/requests/api/members_spec.rb index 79edbb301f2..48869cab4da 100644 --- a/spec/requests/api/members_spec.rb +++ b/spec/requests/api/members_spec.rb @@ -236,7 +236,7 @@ describe API::Members do params: { user_id: stranger.id, access_level: Member::REPORTER } expect(response).to have_gitlab_http_status(400) - expect(json_response['message']['access_level']).to eq(["should be higher than Developer inherited membership from group #{parent.name}"]) + expect(json_response['message']['access_level']).to eq(["should be greater than or equal to Developer inherited membership from group #{parent.name}"]) end it 'creates the member if group level is lower', :nested_groups do diff --git a/spec/support/shared_examples/models/member_shared_examples.rb b/spec/support/shared_examples/models/member_shared_examples.rb index 77376496854..e5375bc8280 100644 --- a/spec/support/shared_examples/models/member_shared_examples.rb +++ b/spec/support/shared_examples/models/member_shared_examples.rb @@ -41,7 +41,7 @@ shared_examples_for 'inherited access level as a member of entity' do member.update(access_level: Gitlab::Access::REPORTER) - expect(member.errors.full_messages).to eq(["Access level should be higher than Developer inherited membership from group #{parent_entity.name}"]) + expect(member.errors.full_messages).to eq(["Access level should be greater than or equal to Developer inherited membership from group #{parent_entity.name}"]) end it 'allows changing the level from a non existing member' do |