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,6 +44,7 @@ ...@@ -44,6 +44,7 @@
%h4.title %h4.title
Trigger Trigger
- if @build.trigger_request&.trigger&.short_token
%p %p
%span.build-light-text Token: %span.build-light-text Token:
#{@build.trigger_request.trigger.short_token} #{@build.trigger_request.trigger.short_token}
......
---
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