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

pipeline_for_sha_loader_spec.rb « loaders « graphql « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 927476cc65500e5a5f9ce5b5139df038293f4388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'spec_helper'

describe Gitlab::Graphql::Loaders::PipelineForShaLoader do
  include GraphqlHelpers

  describe '#find_last' do
    it 'batch-resolves latest pipeline' do
      project = create(:project, :repository)
      pipeline1 = create(:ci_pipeline, project: project, ref: project.default_branch, sha: project.commit.sha)
      pipeline2 = create(:ci_pipeline, project: project, ref: project.default_branch, sha: project.commit.sha)
      pipeline3 = create(:ci_pipeline, project: project, ref: 'improve/awesome', sha: project.commit('improve/awesome').sha)

      result = batch(max_queries: 1) do
        [pipeline1.sha, pipeline3.sha].map { |sha| described_class.new(project, sha).find_last }
      end

      expect(result).to contain_exactly(pipeline2, pipeline3)
    end
  end
end