diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/serializers/group_deploy_key_entity_spec.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/serializers/group_deploy_key_entity_spec.rb')
-rw-r--r-- | spec/serializers/group_deploy_key_entity_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/serializers/group_deploy_key_entity_spec.rb b/spec/serializers/group_deploy_key_entity_spec.rb new file mode 100644 index 00000000000..e6cef2f10b3 --- /dev/null +++ b/spec/serializers/group_deploy_key_entity_spec.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe GroupDeployKeyEntity do + include RequestAwareEntity + + let(:user) { create(:user) } + let(:group) { create(:group) } + let(:group_deploy_key) { create(:group_deploy_key) } + let(:options) { { user: user } } + + let(:entity) { described_class.new(group_deploy_key, options) } + + before do + group.group_deploy_keys << group_deploy_key + end + + describe 'returns group deploy keys with a group a user can read' do + let(:expected_result) do + { + id: group_deploy_key.id, + user_id: group_deploy_key.user_id, + title: group_deploy_key.title, + fingerprint: group_deploy_key.fingerprint, + fingerprint_sha256: group_deploy_key.fingerprint_sha256, + created_at: group_deploy_key.created_at, + updated_at: group_deploy_key.updated_at, + can_edit: false, + group_deploy_keys_groups: [ + { + can_push: false, + group: + { + id: group.id, + name: group.name, + full_path: group.full_path, + full_name: group.full_name + } + } + ] + } + end + + it { expect(entity.as_json).to eq(expected_result) } + end +end |