Commit 7e72fcaa authored by Filipa Lacerda's avatar Filipa Lacerda Committed by Tim Zallmann

Prevent 500 error when inspecting job after trigger was removed

parent 60784251
...@@ -44,9 +44,10 @@ ...@@ -44,9 +44,10 @@
%h4.title %h4.title
Trigger Trigger
%p - if @build.trigger_request&.trigger&.short_token
%span.build-light-text Token: %p
#{@build.trigger_request.trigger.short_token} %span.build-light-text Token:
#{@build.trigger_request.trigger.short_token}
- if @build.trigger_variables.any? - if @build.trigger_variables.any?
%p %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 ...@@ -185,6 +185,31 @@ describe 'projects/jobs/show' do
end end
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 describe 'commit title in sidebar' do
let(:commit_title) { project.commit.title } 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