Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-04-19 10:20:53 +0300
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-04-19 10:20:53 +0300
commit93780da67ceebac19033bb0c44483e3af2d38a18 (patch)
tree7123498ec227f75c6d00e8dbab111a2fa3a2e64f /spec/presenters
parent6ef8b497e721fac49a0914802244f98dd5d99078 (diff)
Resolve "Show `failure_reason` in jobs view content section"
Diffstat (limited to 'spec/presenters')
-rw-r--r--spec/presenters/ci/build_presenter_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/presenters/ci/build_presenter_spec.rb b/spec/presenters/ci/build_presenter_spec.rb
index cc16d0f156b..4bc005df2fc 100644
--- a/spec/presenters/ci/build_presenter_spec.rb
+++ b/spec/presenters/ci/build_presenter_spec.rb
@@ -217,4 +217,39 @@ describe Ci::BuildPresenter do
end
end
end
+
+ describe '#callout_failure_message' do
+ let(:build) { create(:ci_build, :failed, :script_failure) }
+
+ it 'returns a verbose failure reason' do
+ description = subject.callout_failure_message
+ expect(description).to eq('There has been a script failure. Check the job log for more information')
+ end
+ end
+
+ describe '#recoverable?' do
+ let(:build) { create(:ci_build, :failed, :script_failure) }
+
+ context 'when is a script or missing dependency failure' do
+ let(:failure_reasons) { %w(script_failure missing_dependency_failure) }
+
+ it 'should return false' do
+ failure_reasons.each do |failure_reason|
+ build.update_attribute(:failure_reason, failure_reason)
+ expect(presenter.recoverable?).to be_falsy
+ end
+ end
+ end
+
+ context 'when is any other failure type' do
+ let(:failure_reasons) { %w(unknown_failure api_failure stuck_or_timeout_failure runner_system_failure) }
+
+ it 'should return true' do
+ failure_reasons.each do |failure_reason|
+ build.update_attribute(:failure_reason, failure_reason)
+ expect(presenter.recoverable?).to be_truthy
+ end
+ end
+ end
+ end
end