summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-11-06 08:30:50 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-11-06 08:30:50 +0000
commit1109c227e57fac8c53b331b2cda21a87b61970aa (patch)
treef72cc4c5e1de1f6bd53a811b9b5fd2718f237ac8 /spec/models
parent836ab5f7a189129d381ee55972415ce68023f1a1 (diff)
parenta89fb014a3f520d44351489bca73a42f3d4d42e8 (diff)
downloadgitlab-ce-1109c227e57fac8c53b331b2cda21a87b61970aa.tar.gz
Merge branch 'ce-fix_vuln_list_on_group_dashboard' into 'master'
Backport generic methods to CE See merge request gitlab-org/gitlab-ce!22826
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/pipeline_spec.rb13
-rw-r--r--spec/models/namespace_spec.rb11
2 files changed, 24 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 }
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 8913644a3ce..2db42fe802a 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -562,6 +562,17 @@ describe Namespace do
it { expect(group.all_projects.to_a).to match_array([project2, project1]) }
end
+ describe '#all_pipelines' do
+ let(:group) { create(:group) }
+ let(:child) { create(:group, parent: group) }
+ let!(:project1) { create(:project_empty_repo, namespace: group) }
+ let!(:project2) { create(:project_empty_repo, namespace: child) }
+ let!(:pipeline1) { create(:ci_empty_pipeline, project: project1) }
+ let!(:pipeline2) { create(:ci_empty_pipeline, project: project2) }
+
+ it { expect(group.all_pipelines.to_a).to match_array([pipeline1, pipeline2]) }
+ end
+
describe '#share_with_group_lock with subgroups', :nested_groups do
context 'when creating a subgroup' do
let(:subgroup) { create(:group, parent: root_group )}