diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-03-24 13:11:36 +0300 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-03-24 13:53:47 +0300 |
commit | e0dc73527a478188cfa28b456b64798639aa73c9 (patch) | |
tree | 005fa0bf10994020294e423752f289304c5fc83a /spec/serializers/deploy_key_entity_spec.rb | |
parent | 8f6608af65563916897ebdda3c274270c969d604 (diff) |
Project deploy keys json end point
Diffstat (limited to 'spec/serializers/deploy_key_entity_spec.rb')
-rw-r--r-- | spec/serializers/deploy_key_entity_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/serializers/deploy_key_entity_spec.rb b/spec/serializers/deploy_key_entity_spec.rb new file mode 100644 index 00000000000..da1d33b42ac --- /dev/null +++ b/spec/serializers/deploy_key_entity_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +describe DeployKeyEntity do + let(:user) { create(:user) } + let(:project) { create(:empty_project, :internal)} + let(:project_private) { create(:empty_project, :private)} + let(:deploy_key) { create(:deploy_key) } + let!(:deploy_key_internal) { create(:deploy_keys_project, project: project, deploy_key: deploy_key) } + let!(:deploy_key_private) { create(:deploy_keys_project, project: project_private, deploy_key: deploy_key) } + + let(:entity) { described_class.new(deploy_key, user: user) } + + it 'returns deploy keys with projects a user can read' do + expected_result = { + id: deploy_key.id, + user_id: deploy_key.user_id, + title: deploy_key.title, + fingerprint: deploy_key.fingerprint, + can_push: deploy_key.can_push, + created_at: deploy_key.created_at, + updated_at: deploy_key.updated_at, + projects: [ + { id: project.id, name: project.name, full_path: project.full_path, full_name: project.full_name } + ] + } + + expect(entity.as_json).to eq(expected_result) + end +end |