Commit 3dd5bedb authored by Tim Zallmann's avatar Tim Zallmann

Merge branch '36400-trigger-job' into 'master'

Prevent 500 error when inspecting job after trigger was removed

Closes #36400

See merge request gitlab-org/gitlab-ce!15447
parents 60784251 7e72fcaa
......@@ -44,9 +44,10 @@
%h4.title
Trigger
%p
%span.build-light-text Token:
#{@build.trigger_request.trigger.short_token}
- if @build.trigger_request&.trigger&.short_token
%p
%span.build-light-text Token:
#{@build.trigger_request.trigger.short_token}
- if @build.trigger_variables.any?
%p
......
---
title: Prevent 500 error when inspecting job after trigger was removed
merge_request:
author:
type: fixed
......@@ -185,6 +185,31 @@ describe 'projects/jobs/show' do
end
end
context 'when incomplete trigger_request is used' do
before do
build.trigger_request = FactoryGirl.build(:ci_trigger_request, trigger: nil)
end
it 'test should not render token block' do
render
expect(rendered).not_to have_content('Token')
end
end
context 'when complete trigger_request is used' do
before do
build.trigger_request = FactoryGirl.build(:ci_trigger_request)
end
it 'should render token' do
render
expect(rendered).to have_content('Token')
expect(rendered).to have_content(build.trigger_request.trigger.short_token)
end
end
describe 'commit title in sidebar' do
let(:commit_title) { project.commit.title }
......
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