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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-08 16:05:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-08 16:05:05 +0300
commit8fa311a5de24a28d8190b0a038fb893e71184eb2 (patch)
treeae489a4ab340f24312cc1d968f74e5b22ac094d4 /spec/lib/api
parent0fabe9336cf7cf2a31156931e716e84fc45e842f (diff)
Add latest changes from gitlab-org/gitlab@14-0-stable-ee
Diffstat (limited to 'spec/lib/api')
-rw-r--r--spec/lib/api/entities/package_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/lib/api/entities/package_spec.rb b/spec/lib/api/entities/package_spec.rb
new file mode 100644
index 00000000000..d63ea7833ac
--- /dev/null
+++ b/spec/lib/api/entities/package_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe API::Entities::Package do
+ let(:package) { create(:generic_package) }
+
+ subject { described_class.new(package).as_json(namespace: package.project.namespace) }
+
+ it 'exposes correct attributes' do
+ expect(subject).to include(
+ :id,
+ :name,
+ :version,
+ :package_type,
+ :status,
+ :_links,
+ :created_at,
+ :tags,
+ :versions
+ )
+ end
+
+ it 'exposes correct web_path in _links' do
+ expect(subject[:_links][:web_path]).to match('/packages/')
+ end
+
+ context 'with a terraform_module' do
+ let(:package) { create(:terraform_module_package) }
+
+ it 'exposes correct web_path in _links' do
+ expect(subject[:_links][:web_path]).to match('/infrastructure_registry/')
+ end
+ end
+end