summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-11-24 09:20:34 +0000
committerTim Zallmann <tzallmann@gitlab.com>2017-11-24 09:20:34 +0000
commit7e72fcaa095b77f7caac3fb6214ad21f7d6dd2b3 (patch)
treedeb65d3be6788e83d0831faadcc9a8425dbbbc3c /spec/views
parent6078425118c27db2ffa394579316eb81cd231d83 (diff)
downloadgitlab-ce-7e72fcaa095b77f7caac3fb6214ad21f7d6dd2b3.tar.gz
Prevent 500 error when inspecting job after trigger was removed
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/projects/jobs/show.html.haml_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/views/projects/jobs/show.html.haml_spec.rb b/spec/views/projects/jobs/show.html.haml_spec.rb
index d4279626e75..6139529013f 100644
--- a/spec/views/projects/jobs/show.html.haml_spec.rb
+++ b/spec/views/projects/jobs/show.html.haml_spec.rb
@@ -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 }