summaryrefslogtreecommitdiff
path: root/spec/serializers/build_serializer_spec.rb
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2018-04-05 21:04:42 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-04-05 21:04:42 +0000
commitd54cf868f81ca957c8322661b11e6755d9ea5a85 (patch)
tree39ef104a65a13fc41a5fcc3a79b9e1ec9c154d3d /spec/serializers/build_serializer_spec.rb
parentdd271e246001a06609592eef109d154291305d32 (diff)
downloadgitlab-ce-d54cf868f81ca957c8322661b11e6755d9ea5a85.tar.gz
Resolve "Show `failure_reason` and upgrade tooltips of jobs"
Diffstat (limited to 'spec/serializers/build_serializer_spec.rb')
-rw-r--r--spec/serializers/build_serializer_spec.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/spec/serializers/build_serializer_spec.rb b/spec/serializers/build_serializer_spec.rb
index 9673b11c2a2..98cd15e248b 100644
--- a/spec/serializers/build_serializer_spec.rb
+++ b/spec/serializers/build_serializer_spec.rb
@@ -28,15 +28,31 @@ describe BuildSerializer do
end
describe '#represent_status' do
- context 'when represents only status' do
- let(:resource) { create(:ci_build) }
+ context 'for a failed build' do
+ let(:resource) { create(:ci_build, :failed) }
+ let(:status) { resource.detailed_status(double('user')) }
+
+ subject { serializer.represent_status(resource) }
+
+ it 'serializes only status' do
+ expect(subject[:text]).to eq(status.text)
+ expect(subject[:label]).to eq('failed')
+ expect(subject[:tooltip]).to eq('failed <br> (unknown failure)')
+ expect(subject[:icon]).to eq(status.icon)
+ expect(subject[:favicon]).to match_asset_path("/assets/ci_favicons/#{status.favicon}.ico")
+ end
+ end
+
+ context 'for any other type of build' do
+ let(:resource) { create(:ci_build, :success) }
let(:status) { resource.detailed_status(double('user')) }
subject { serializer.represent_status(resource) }
it 'serializes only status' do
expect(subject[:text]).to eq(status.text)
- expect(subject[:label]).to eq(status.label)
+ expect(subject[:label]).to eq('passed')
+ expect(subject[:tooltip]).to eq('passed')
expect(subject[:icon]).to eq(status.icon)
expect(subject[:favicon]).to match_asset_path("/assets/ci_favicons/#{status.favicon}.ico")
end