Commit fb312dc3 authored by Wei-Meng Lee's avatar Wei-Meng Lee Committed by Shinya Maeda

Fix error when blob has no auxiliary viewer

parent 1b464470
......@@ -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