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>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
parent0fabe9336cf7cf2a31156931e716e84fc45e842f (diff)
Add latest changes from gitlab-org/gitlab@14-0-stable-ee
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/api/entities/package_spec.rb35
-rw-r--r--spec/lib/gitlab/path_regex_spec.rb2
2 files changed, 37 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
diff --git a/spec/lib/gitlab/path_regex_spec.rb b/spec/lib/gitlab/path_regex_spec.rb
index 54c866b4a6d..d343634fb92 100644
--- a/spec/lib/gitlab/path_regex_spec.rb
+++ b/spec/lib/gitlab/path_regex_spec.rb
@@ -445,6 +445,8 @@ RSpec.describe Gitlab::PathRegex do
[
'gitlab-org',
'gitlab-org/gitlab-test',
+ 'gitlab-org/foo.',
+ 'gitlab-org/bar..',
'gitlab-org/gitlab-test/snippets/1',
'gitlab-org/gitlab-test/snippets/foo', # ambiguous, we allow creating a sub-group called 'snippets'
'snippets/1'