summaryrefslogtreecommitdiff
path: root/spec/models/ci/pipeline_spec.rb
diff options
context:
space:
mode:
authorOlivier Gonzalez <ogonzalez@gitlab.com>2018-11-05 18:56:52 -0500
committerOlivier Gonzalez <ogonzalez@gitlab.com>2018-11-05 18:56:52 -0500
commita89fb014a3f520d44351489bca73a42f3d4d42e8 (patch)
tree5d5274efd590da2184665e11e18e722a3026a076 /spec/models/ci/pipeline_spec.rb
parent57bc28e7907cc5166030c10638a2c756cb45dcaa (diff)
downloadgitlab-ce-a89fb014a3f520d44351489bca73a42f3d4d42e8.tar.gz
Backport generic methods to CEce-fix_vuln_list_on_group_dashboard
Allow to fetch all pipelines for every projects in a group and its subgroups. Allow to fetch the latest pipeline id for each projects of a group and its subgroups.
Diffstat (limited to 'spec/models/ci/pipeline_spec.rb')
-rw-r--r--spec/models/ci/pipeline_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 153244b2159..0f58c06864e 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -1148,6 +1148,19 @@ describe Ci::Pipeline, :mailer do
end
end
+ describe '.latest_successful_ids_per_project' do
+ let(:projects) { create_list(:project, 2) }
+ let!(:pipeline1) { create(:ci_pipeline, :success, project: projects[0]) }
+ let!(:pipeline2) { create(:ci_pipeline, :success, project: projects[0]) }
+ let!(:pipeline3) { create(:ci_pipeline, :failed, project: projects[0]) }
+ let!(:pipeline4) { create(:ci_pipeline, :success, project: projects[1]) }
+
+ it 'returns expected pipeline ids' do
+ expect(described_class.latest_successful_ids_per_project)
+ .to contain_exactly(pipeline2, pipeline4)
+ end
+ end
+
describe '.internal_sources' do
subject { described_class.internal_sources }