diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 16:54:15 +0300 |
commit | be834a25982746ffd85252ff502df42bb88cb9d5 (patch) | |
tree | b4d6a8ba0931e12fac08f05abea33a3b8ec2c8a2 /spec/serializers/group_group_link_entity_spec.rb | |
parent | ee925a3597f27e92f83a50937a64068109675b3d (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc32
Diffstat (limited to 'spec/serializers/group_group_link_entity_spec.rb')
-rw-r--r-- | spec/serializers/group_group_link_entity_spec.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/spec/serializers/group_group_link_entity_spec.rb b/spec/serializers/group_group_link_entity_spec.rb index 8384563e3e6..9affe4af381 100644 --- a/spec/serializers/group_group_link_entity_spec.rb +++ b/spec/serializers/group_group_link_entity_spec.rb @@ -5,9 +5,27 @@ require 'spec_helper' RSpec.describe GroupGroupLinkEntity do include_context 'group_group_link' - subject(:json) { described_class.new(group_group_link).to_json } + let_it_be(:current_user) { create(:user) } + let(:entity) { described_class.new(group_group_link) } + + before do + allow(entity).to receive(:current_user).and_return(current_user) + end it 'matches json schema' do - expect(json).to match_schema('entities/group_group_link') + expect(entity.to_json).to match_schema('entities/group_group_link') + end + + context 'a user with :admin_group_member permissions' do + before do + allow(entity).to receive(:can?).with(current_user, :admin_group_member, shared_group).and_return(true) + end + + it 'sets `can_update` and `can_remove` to `true`' do + json = entity.as_json + + expect(json[:can_update]).to be true + expect(json[:can_remove]).to be true + end end end |