summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2019-04-16 12:54:47 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2019-04-16 12:54:47 +0000
commitc16619c527afdd00aa4dbbbf7544afb2f38477a8 (patch)
tree2d541ceff47cbd16a3a6ea72e0f5e65b0c7b633b /spec/models
parent29a53c4c31b8901f87818c86a9e8339334743616 (diff)
parent0cfa25ff21322d45aaef91fc7a3dd7c570632a05 (diff)
downloadgitlab-ce-c16619c527afdd00aa4dbbbf7544afb2f38477a8.tar.gz
Merge branch 'mc/feature/custom-metrics-ce' into 'master'
Backport metrics report type See merge request gitlab-org/gitlab-ce!26798
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 2b6b12650af..fd66e344d63 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 }
@@ -2729,8 +2749,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