Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-30 18:08:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-30 18:08:09 +0300
commit538fff823de57d1ba5317961aa43091de9dc007f (patch)
treec741665b338cc0d51ce5f73f5671e5eee8e69349 /spec/models/commit_collection_spec.rb
parent3692e9f8a23386c627942ca2a9edd8c00af7e904 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/commit_collection_spec.rb')
-rw-r--r--spec/models/commit_collection_spec.rb45
1 files changed, 24 insertions, 21 deletions
diff --git a/spec/models/commit_collection_spec.rb b/spec/models/commit_collection_spec.rb
index 0bdf83fa90f..a8957bbfdd0 100644
--- a/spec/models/commit_collection_spec.rb
+++ b/spec/models/commit_collection_spec.rb
@@ -51,6 +51,30 @@ describe CommitCollection do
end
end
+ describe '#with_latest_pipeline' do
+ let!(:pipeline) do
+ create(
+ :ci_empty_pipeline,
+ ref: 'master',
+ sha: commit.id,
+ status: 'success',
+ project: project
+ )
+ end
+ let(:collection) { described_class.new(project, [commit]) }
+
+ it 'sets the latest pipeline for every commit so no additional queries are necessary' do
+ commits = collection.with_latest_pipeline('master')
+
+ recorder = ActiveRecord::QueryRecorder.new do
+ expect(commits.map { |c| c.latest_pipeline('master') })
+ .to eq([pipeline])
+ end
+
+ expect(recorder.count).to be_zero
+ end
+ end
+
describe 'enrichment methods' do
let(:gitaly_commit) { commit }
let(:hash_commit) { Commit.from_hash(gitaly_commit.to_hash, project) }
@@ -128,27 +152,6 @@ describe CommitCollection do
end
end
- describe '#with_pipeline_status' do
- it 'sets the pipeline status for every commit so no additional queries are necessary' do
- create(
- :ci_empty_pipeline,
- ref: 'master',
- sha: commit.id,
- status: 'success',
- project: project
- )
-
- collection = described_class.new(project, [commit])
- collection.with_pipeline_status
-
- recorder = ActiveRecord::QueryRecorder.new do
- expect(commit.status).to eq('success')
- end
-
- expect(recorder.count).to be_zero
- end
- end
-
describe '#respond_to_missing?' do
it 'returns true when the underlying Array responds to the message' do
collection = described_class.new(project, [])