summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-05-25 13:43:11 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-05-25 13:45:08 +0200
commit1af2274b4126b3e910604ef321b58d327ea21e63 (patch)
tree3ac54e92ce31c5cfad7857874e2dadb982555cea /spec/lib/gitlab/ci
parentc0827455ab20a156b86a20556c79139e4eb114e5 (diff)
downloadgitlab-ce-1af2274b4126b3e910604ef321b58d327ea21e63.tar.gz
Restore lazy loading of pipeline commits in preloader
Diffstat (limited to 'spec/lib/gitlab/ci')
-rw-r--r--spec/lib/gitlab/ci/pipeline/preloader_spec.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/preloader_spec.rb b/spec/lib/gitlab/ci/pipeline/preloader_spec.rb
index 7821d28ab06..40dfd893465 100644
--- a/spec/lib/gitlab/ci/pipeline/preloader_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/preloader_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'fast_spec_helper'
+require 'spec_helper'
describe Gitlab::Ci::Pipeline::Preloader do
let(:stage) { double(:stage) }
@@ -11,6 +11,23 @@ describe Gitlab::Ci::Pipeline::Preloader do
end
describe '.preload!' do
+ context 'when preloading multiple commits' do
+ let(:project) { create(:project, :repository) }
+
+ it 'preloads all commits once' do
+ expect(Commit).to receive(:decorate).once.and_call_original
+
+ pipelines = [build_pipeline(ref: 'HEAD'),
+ build_pipeline(ref: 'HEAD~1')]
+
+ described_class.preload!(pipelines)
+ end
+
+ def build_pipeline(ref:)
+ build_stubbed(:ci_pipeline, project: project, sha: project.commit(ref).id)
+ end
+ end
+
it 'preloads commit authors and number of warnings' do
expect(commit).to receive(:lazy_author)
expect(pipeline).to receive(:number_of_warnings)