diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2017-10-06 13:33:10 +0300 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2017-10-06 13:33:10 +0300 |
commit | c0cfc9ebd26583c444f2cce1a23f939bfa7d8969 (patch) | |
tree | a6e7260211e51b0286afc7cca7b11e985621d5c1 /spec/models/ci | |
parent | ea023138bf5116a729e5accd5f81d4e586af6b02 (diff) |
Extract `Ci::Build#parse_trace_sections!` into a service
Diffstat (limited to 'spec/models/ci')
-rw-r--r-- | spec/models/ci/build_spec.rb | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 7fe12f92a2a..06f76b5501e 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -322,24 +322,13 @@ describe Ci::Build do end describe '#parse_trace_sections!' do - context "when the build trace has sections markers," do - before do - build.trace.set(File.read(expand_fixture_path('trace/trace_with_sections'))) - end - - it "saves the correct extracted sections" do - expect(build.trace_sections).to be_empty - expect(build.parse_trace_sections!).to be(true) - expect(build.trace_sections).not_to be_empty - end - - it "fails if trace_sections isn't empty" do - expect(build.parse_trace_sections!).to be(true) - expect(build.trace_sections).not_to be_empty + it 'calls ExtractSectionsFromBuildTraceService' do + expect(Ci::ExtractSectionsFromBuildTraceService) + .to receive(:new).with(project, build.user).once.and_call_original + expect_any_instance_of(Ci::ExtractSectionsFromBuildTraceService) + .to receive(:execute).with(build).once - expect(build.parse_trace_sections!).to be(false) - expect(build.trace_sections).not_to be_empty - end + build.parse_trace_sections! end end |