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>2023-12-22 18:12:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-22 18:12:49 +0300
commitc60010859638f577dab891358e83945561b35ad2 (patch)
tree6badf09d24d14aa03bf265f4ba7dcc368ac9fa78 /spec/lib
parent26fa51816ab94df9c2f3db8c93da4d57f7bd6fc4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/banzai/pipeline/gfm_pipeline_spec.rb15
-rw-r--r--spec/lib/container_registry/gitlab_api_client_spec.rb20
-rw-r--r--spec/lib/gitlab/git/tree_spec.rb12
-rw-r--r--spec/lib/gitlab/redis/sessions_spec.rb21
4 files changed, 45 insertions, 23 deletions
diff --git a/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb b/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
index a845e4fa7f4..bb6d4eeefbc 100644
--- a/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
+++ b/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
@@ -167,6 +167,21 @@ RSpec.describe Banzai::Pipeline::GfmPipeline, feature_category: :team_planning d
end
end
+ context 'when label reference is similar to a commit SHA' do
+ let(:numeric_commit_sha) { '8634272' }
+ let(:project) { create(:project, :repository) }
+ let(:label) { create(:label, project: project, id: numeric_commit_sha) }
+
+ it 'renders a label reference' do
+ expect(project.commit_by(oid: numeric_commit_sha)).to be_present
+
+ output = described_class.to_html(label.to_reference(format: :id), project: project)
+
+ expect(output).to include(label.name)
+ expect(output).to include(Gitlab::Routing.url_helpers.project_issues_path(project, label_name: label.name))
+ end
+ end
+
describe 'asset proxy' do
let(:project) { create(:project, :public) }
let(:image) { '![proxy](http://example.com/test.png)' }
diff --git a/spec/lib/container_registry/gitlab_api_client_spec.rb b/spec/lib/container_registry/gitlab_api_client_spec.rb
index 3c87af3a1c8..e13f639f048 100644
--- a/spec/lib/container_registry/gitlab_api_client_spec.rb
+++ b/spec/lib/container_registry/gitlab_api_client_spec.rb
@@ -256,6 +256,23 @@ RSpec.describe ContainerRegistry::GitlabApiClient, feature_category: :container_
it { is_expected.to eq(expected) }
end
+ context 'with referrers included' do
+ subject { client.tags(path, page_size: page_size, referrers: true) }
+
+ let(:expected) do
+ {
+ pagination: {},
+ response_body: ::Gitlab::Json.parse(response.to_json)
+ }
+ end
+
+ before do
+ stub_tags(path, page_size: page_size, input: { referrers: 'true' }, respond_with: response)
+ end
+
+ it { is_expected.to eq(expected) }
+ end
+
context 'with a response with a link header containing next page' do
let(:expected) do
{
@@ -961,7 +978,8 @@ RSpec.describe ContainerRegistry::GitlabApiClient, feature_category: :container_
last: input[:last],
name: input[:name],
sort: input[:sort],
- before: input[:before]
+ before: input[:before],
+ referrers: input[:referrers]
}.compact
url = "#{registry_api_url}/gitlab/v1/repositories/#{path}/tags/list/"
diff --git a/spec/lib/gitlab/git/tree_spec.rb b/spec/lib/gitlab/git/tree_spec.rb
index 090f9af2620..468df96b356 100644
--- a/spec/lib/gitlab/git/tree_spec.rb
+++ b/spec/lib/gitlab/git/tree_spec.rb
@@ -9,7 +9,17 @@ RSpec.describe Gitlab::Git::Tree, feature_category: :source_code_management do
let_it_be(:repository) { project.repository.raw }
shared_examples 'repo' do
- subject(:tree) { Gitlab::Git::Tree.where(repository, sha, path, recursive, skip_flat_paths, rescue_not_found, pagination_params) }
+ subject(:tree) do
+ Gitlab::Git::Tree.tree_entries(
+ repository: repository,
+ sha: sha,
+ path: path,
+ recursive: recursive,
+ skip_flat_paths: skip_flat_paths,
+ rescue_not_found: rescue_not_found,
+ pagination_params: pagination_params
+ )
+ end
let(:sha) { SeedRepo::Commit::ID }
let(:path) { nil }
diff --git a/spec/lib/gitlab/redis/sessions_spec.rb b/spec/lib/gitlab/redis/sessions_spec.rb
index b02864cb73d..874822e3e6a 100644
--- a/spec/lib/gitlab/redis/sessions_spec.rb
+++ b/spec/lib/gitlab/redis/sessions_spec.rb
@@ -5,27 +5,6 @@ require 'spec_helper'
RSpec.describe Gitlab::Redis::Sessions do
it_behaves_like "redis_new_instance_shared_examples", 'sessions', Gitlab::Redis::SharedState
- describe 'redis instance used in connection pool' do
- around do |example|
- clear_pool
- example.run
- ensure
- clear_pool
- end
-
- it 'uses ::Redis instance' do
- described_class.pool.with do |redis_instance|
- expect(redis_instance).to be_instance_of(::Redis)
- end
- end
-
- def clear_pool
- described_class.remove_instance_variable(:@pool)
- rescue NameError
- # raised if @pool was not set; ignore
- end
- end
-
describe '#store' do
subject(:store) { described_class.store(namespace: described_class::SESSION_NAMESPACE) }