Commit d8429213 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'weimeng-master-patch-35379' into 'master'

Fix error when blob has no auxiliary viewer

See merge request gitlab-org/gitlab!38018
parents 50a0415e fb312dc3
......@@ -359,7 +359,7 @@ module BlobHelper
def show_suggest_pipeline_creation_celebration?
experiment_enabled?(:suggest_pipeline) &&
@blob.path == Gitlab::FileDetector::PATTERNS[:gitlab_ci] &&
@blob.auxiliary_viewer.valid?(project: @project, sha: @commit.sha, user: current_user) &&
@blob.auxiliary_viewer&.valid?(project: @project, sha: @commit.sha, user: current_user) &&
@project.uses_default_ci_config? &&
cookies[suggest_pipeline_commit_cookie_name].present?
end
......
---
title: Fix error when blob has no auxiliary viewer
merge_request: 38018
author:
type: fixed
......@@ -282,6 +282,16 @@ RSpec.describe BlobHelper do
expect(helper.show_suggest_pipeline_creation_celebration?).to be_falsey
end
end
context 'blob does not have auxiliary view' do
before do
allow(blob).to receive(:auxiliary_viewer).and_return(nil)
end
it 'is false' do
expect(helper.show_suggest_pipeline_creation_celebration?).to be_falsey
end
end
end
context 'experiment disabled' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment