diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-05 21:04:42 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-04-05 21:04:42 +0000 |
commit | d54cf868f81ca957c8322661b11e6755d9ea5a85 (patch) | |
tree | 39ef104a65a13fc41a5fcc3a79b9e1ec9c154d3d /spec/serializers/build_serializer_spec.rb | |
parent | dd271e246001a06609592eef109d154291305d32 (diff) | |
download | gitlab-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.rb | 22 |
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 |