summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2019-04-16 13:06:52 +0200
committerMatija Čupić <matteeyah@gmail.com>2019-04-16 13:06:52 +0200
commit0cfa25ff21322d45aaef91fc7a3dd7c570632a05 (patch)
tree11e9c6393808c22ecb0bfd3ccee945a39029145f /spec/models
parentfc1dfae41c7e6e1bbaa95bc4a1e087ffddfcc57b (diff)
downloadgitlab-ce-0cfa25ff21322d45aaef91fc7a3dd7c570632a05.tar.gz
Backport changes from EE
This backports the changes from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10452
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/build_spec.rb4
-rw-r--r--spec/models/ci/pipeline_spec.rb24
2 files changed, 24 insertions, 4 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 1352a2de2d7..66be192ab21 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -166,8 +166,8 @@ describe Ci::Build do
end
end
- describe '.with_test_reports' do
- subject { described_class.with_test_reports }
+ describe '.with_reports' do
+ subject { described_class.with_reports(Ci::JobArtifact.test_reports) }
context 'when build has a test report' do
let!(:build) { create(:ci_build, :success, :test_reports) }
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index f3e78630c1b..f8d7579ab6a 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -426,6 +426,26 @@ describe Ci::Pipeline, :mailer do
end
end
+ describe '.with_reports' do
+ subject { described_class.with_reports(Ci::JobArtifact.test_reports) }
+
+ context 'when pipeline has a test report' do
+ let!(:pipeline_with_report) { create(:ci_pipeline, :with_test_reports) }
+
+ it 'selects the pipeline' do
+ is_expected.to eq([pipeline_with_report])
+ end
+ end
+
+ context 'when pipeline does not have metrics reports' do
+ let!(:pipeline_without_report) { create(:ci_empty_pipeline) }
+
+ it 'does not select the pipeline' do
+ is_expected.to be_empty
+ end
+ end
+ end
+
describe '.merge_request_event' do
subject { described_class.merge_request_event }
@@ -2728,8 +2748,8 @@ describe Ci::Pipeline, :mailer do
end
end
- describe '#has_test_reports?' do
- subject { pipeline.has_test_reports? }
+ describe '#has_reports?' do
+ subject { pipeline.has_reports?(Ci::JobArtifact.test_reports) }
context 'when pipeline has builds with test reports' do
before do