diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-08 16:05:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-08 16:05:05 +0300 |
commit | 8fa311a5de24a28d8190b0a038fb893e71184eb2 (patch) | |
tree | ae489a4ab340f24312cc1d968f74e5b22ac094d4 /spec/lib | |
parent | 0fabe9336cf7cf2a31156931e716e84fc45e842f (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.rb | 35 | ||||
-rw-r--r-- | spec/lib/gitlab/path_regex_spec.rb | 2 |
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' |