From 8fa311a5de24a28d8190b0a038fb893e71184eb2 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 8 Jul 2021 13:05:05 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-0-stable-ee --- spec/lib/api/entities/package_spec.rb | 35 +++++++++++++++++++++++++++++++++++ spec/lib/gitlab/path_regex_spec.rb | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 spec/lib/api/entities/package_spec.rb (limited to 'spec/lib') 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' -- cgit v1.2.3