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/serializers
parent6ef8b497e721fac49a0914802244f98dd5d99078 (diff)
Resolve "Show `failure_reason` in jobs view content section"
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/job_entity_spec.rb63
1 files changed, 53 insertions, 10 deletions
diff --git a/spec/serializers/job_entity_spec.rb b/spec/serializers/job_entity_spec.rb
index 24a6f1a2a8a..c90396ebb28 100644
--- a/spec/serializers/job_entity_spec.rb
+++ b/spec/serializers/job_entity_spec.rb
@@ -133,22 +133,65 @@ describe JobEntity do
context 'when job failed' do
let(:job) { create(:ci_build, :script_failure) }
- describe 'status' do
- it 'should contain the failure reason inside label' do
- expect(subject[:status]).to include :icon, :favicon, :text, :label, :tooltip
- expect(subject[:status][:label]).to eq('failed')
- expect(subject[:status][:tooltip]).to eq('failed <br> (script failure)')
- end
+ it 'contains details' do
+ expect(subject[:status]).to include :icon, :favicon, :text, :label, :tooltip
+ end
+
+ it 'states that it failed' do
+ expect(subject[:status][:label]).to eq('failed')
+ end
+
+ it 'should indicate the failure reason on tooltip' do
+ expect(subject[:status][:tooltip]).to eq('failed <br> (script failure)')
+ end
+
+ it 'should include a callout message with a verbose output' do
+ expect(subject[:callout_message]).to eq('There has been a script failure. Check the job log for more information')
+ end
+
+ it 'should state that it is not recoverable' do
+ expect(subject[:recoverable]).to be_falsy
+ end
+ end
+
+ context 'when job is allowed to fail' do
+ let(:job) { create(:ci_build, :allowed_to_fail, :script_failure) }
+
+ it 'contains details' do
+ expect(subject[:status]).to include :icon, :favicon, :text, :label, :tooltip
+ end
+
+ it 'states that it failed' do
+ expect(subject[:status][:label]).to eq('failed (allowed to fail)')
+ end
+
+ it 'should indicate the failure reason on tooltip' do
+ expect(subject[:status][:tooltip]).to eq('failed <br> (script failure) (allowed to fail)')
+ end
+
+ it 'should include a callout message with a verbose output' do
+ expect(subject[:callout_message]).to eq('There has been a script failure. Check the job log for more information')
+ end
+
+ it 'should state that it is not recoverable' do
+ expect(subject[:recoverable]).to be_falsy
+ end
+ end
+
+ context 'when job failed and is recoverable' do
+ let(:job) { create(:ci_build, :api_failure) }
+
+ it 'should state it is recoverable' do
+ expect(subject[:recoverable]).to be_truthy
end
end
context 'when job passed' do
let(:job) { create(:ci_build, :success) }
- describe 'status' do
- it 'should not contain the failure reason inside label' do
- expect(subject[:status][:label]).to eq('passed')
- end
+ it 'should not include callout message or recoverable keys' do
+ expect(subject).not_to include('callout_message')
+ expect(subject).not_to include('recoverable')
end
end
end