diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-08-03 15:13:39 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-08-03 15:13:39 +0900 |
commit | 85af3ea21a5a772cb22756190268ba3f921a6400 (patch) | |
tree | 4231bb48df2693c9600b5c5b7dabb9bae41c1d3e /spec/models | |
parent | 1f53cf7cf0cb53b5d69ab141fa9020356e62027e (diff) | |
download | gitlab-ce-85af3ea21a5a772cb22756190268ba3f921a6400.tar.gz |
Added unique identifier to calculate_reactive_cache. Decoupled comparison logic to service. Fixed N+1 select queries.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ci/build_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 19 |
2 files changed, 8 insertions, 13 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 7137c07c55d..858e448a3d8 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -2845,7 +2845,7 @@ describe Ci::Build do context 'when build does not have test reports' do it 'raises an error' do - expect { subject }.to raise_error(ArgumentError) + expect { subject }.to raise_error(NoMethodError) end end end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 161c0b48626..d28250dbab7 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -1127,7 +1127,9 @@ describe MergeRequest do end context 'when head pipeline has test reports' do - let!(:job_artifact) { create(:ci_job_artifact, :junit, job: head_pipeline.builds.first, project: project) } + before do + create(:ci_job_artifact, :junit, job: head_pipeline.builds.first, project: project) + end context 'when reactive cache worker is parsing asynchronously' do it 'returns status' do @@ -1141,17 +1143,10 @@ describe MergeRequest do end it 'returns status and data' do - expect(subject[:status]).to eq(:parsed) - expect(subject[:data]).to be_a(String) - end + expect_any_instance_of(Ci::CompareTestReportsService) + .to receive(:execute).with(base_pipeline.iid, head_pipeline.iid) - context 'when test reports contains invalid data' do - let!(:job_artifact) { create(:ci_job_artifact, :junit_with_corrupted_data, job: head_pipeline.builds.first, project: project) } - - it 'returns status and error message' do - expect(subject[:status]).to eq(:error) - expect(subject[:status_reason]).to eq('Invalid XML data') - end + subject end end end @@ -1159,7 +1154,7 @@ describe MergeRequest do context 'when head pipeline does not have test reports' do it 'returns status and error message' do expect(subject[:status]).to eq(:error) - expect(subject[:status_reason]).to eq('head pipeline does not have test reports') + expect(subject[:status_reason]).to eq('This merge request does not have test reports') end end end |