Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-23 22:44:23 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-23 22:44:23 +0300
commit6b96d119aec0ba674cca2c380cf60f1500306612 (patch)
treef7742d802f557d04e2144b06a2b47719fbd58b82 /spec/lib
parent8b7c4494871c7d69ac7bc59839bdce6ff2937f95 (diff)
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/api/entities/deploy_key_spec.rb22
-rw-r--r--spec/lib/api/entities/deploy_keys_project_spec.rb25
-rw-r--r--spec/lib/api/entities/ssh_key_spec.rb22
3 files changed, 69 insertions, 0 deletions
diff --git a/spec/lib/api/entities/deploy_key_spec.rb b/spec/lib/api/entities/deploy_key_spec.rb
new file mode 100644
index 00000000000..704dabae63b
--- /dev/null
+++ b/spec/lib/api/entities/deploy_key_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe API::Entities::DeployKey do
+ describe '#as_json' do
+ subject { entity.as_json }
+
+ let(:deploy_key) { create(:deploy_key, public: true) }
+ let(:entity) { described_class.new(deploy_key) }
+
+ it 'includes basic fields', :aggregate_failures do
+ is_expected.to include(
+ id: deploy_key.id,
+ title: deploy_key.title,
+ created_at: deploy_key.created_at,
+ expires_at: deploy_key.expires_at,
+ key: deploy_key.key
+ )
+ end
+ end
+end
diff --git a/spec/lib/api/entities/deploy_keys_project_spec.rb b/spec/lib/api/entities/deploy_keys_project_spec.rb
new file mode 100644
index 00000000000..a357467d7ce
--- /dev/null
+++ b/spec/lib/api/entities/deploy_keys_project_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe API::Entities::DeployKeysProject do
+ describe '#as_json' do
+ subject { entity.as_json }
+
+ let(:deploy_keys_project) { create(:deploy_keys_project, :write_access) }
+ let(:entity) { described_class.new(deploy_keys_project) }
+
+ it 'includes basic fields', :aggregate_failures do
+ deploy_key = deploy_keys_project.deploy_key
+
+ is_expected.to include(
+ id: deploy_key.id,
+ title: deploy_key.title,
+ created_at: deploy_key.created_at,
+ expires_at: deploy_key.expires_at,
+ key: deploy_key.key,
+ can_push: deploy_keys_project.can_push
+ )
+ end
+ end
+end
diff --git a/spec/lib/api/entities/ssh_key_spec.rb b/spec/lib/api/entities/ssh_key_spec.rb
new file mode 100644
index 00000000000..25a0fecfb75
--- /dev/null
+++ b/spec/lib/api/entities/ssh_key_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe API::Entities::SSHKey do
+ describe '#as_json' do
+ subject { entity.as_json }
+
+ let(:key) { create(:key, user: create(:user)) }
+ let(:entity) { described_class.new(key) }
+
+ it 'includes basic fields', :aggregate_failures do
+ is_expected.to include(
+ id: key.id,
+ title: key.title,
+ created_at: key.created_at,
+ expires_at: key.expires_at,
+ key: key.publishable_key
+ )
+ end
+ end
+end