diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/serializers/build_trace_entity_spec.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) | |
download | gitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/serializers/build_trace_entity_spec.rb')
-rw-r--r-- | spec/serializers/build_trace_entity_spec.rb | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/spec/serializers/build_trace_entity_spec.rb b/spec/serializers/build_trace_entity_spec.rb index bafead04a51..82bd56caaac 100644 --- a/spec/serializers/build_trace_entity_spec.rb +++ b/spec/serializers/build_trace_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe BuildTraceEntity do +RSpec.describe BuildTraceEntity do let(:build) { build_stubbed(:ci_build) } let(:request) { double('request') } @@ -13,7 +13,7 @@ describe BuildTraceEntity do end let(:build_trace) do - Ci::BuildTrace.new(build: build, stream: stream, content_format: content_format, state: nil) + Ci::BuildTrace.new(build: build, stream: stream, state: nil) end let(:entity) do @@ -22,42 +22,24 @@ describe BuildTraceEntity do subject { entity.as_json } - shared_examples 'includes build and trace metadata' do - it 'includes build attributes' do - expect(subject[:id]).to eq(build.id) - expect(subject[:status]).to eq(build.status) - expect(subject[:complete]).to eq(build.complete?) - end - - it 'includes trace metadata' do - expect(subject).to include(:state) - expect(subject).to include(:append) - expect(subject).to include(:truncated) - expect(subject).to include(:offset) - expect(subject).to include(:size) - expect(subject).to include(:total) - end + it 'includes build attributes' do + expect(subject[:id]).to eq(build.id) + expect(subject[:status]).to eq(build.status) + expect(subject[:complete]).to eq(build.complete?) end - context 'when content format is :json' do - let(:content_format) { :json } - - it_behaves_like 'includes build and trace metadata' - - it 'includes the trace content in json' do - expect(subject[:lines]).to eq([ - { offset: 0, content: [{ text: 'the-trace' }] } - ]) - end + it 'includes trace metadata' do + expect(subject).to include(:state) + expect(subject).to include(:append) + expect(subject).to include(:truncated) + expect(subject).to include(:offset) + expect(subject).to include(:size) + expect(subject).to include(:total) end - context 'when content format is :html' do - let(:content_format) { :html } - - it_behaves_like 'includes build and trace metadata' - - it 'includes the trace content in json' do - expect(subject[:html]).to eq('<span>the-trace</span>') - end + it 'includes the trace content in json' do + expect(subject[:lines]).to eq([ + { offset: 0, content: [{ text: 'the-trace' }] } + ]) end end |