diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-06-28 13:02:57 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-06-28 13:02:57 +0300 |
commit | 2321b337f1487031e2cab8e1a4e778f3aaf8e2da (patch) | |
tree | 09ac0a7fe65e4da93f873e4b8cf02b57cd359791 /spec/lib/gitlab | |
parent | 1012cfb0b780bc9348a8478a66af2a337a69b0f6 (diff) | |
parent | d78f7ceac94abe0e8318c6472fc5f7967325a74f (diff) |
Merge branch 'graphql-tree-last-commit' into 'master'
Added commit type to tree GraphQL type
See merge request gitlab-org/gitlab-ce!29412
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/graphql/loaders/pipeline_for_sha_loader_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/graphql/loaders/pipeline_for_sha_loader_spec.rb b/spec/lib/gitlab/graphql/loaders/pipeline_for_sha_loader_spec.rb new file mode 100644 index 00000000000..927476cc655 --- /dev/null +++ b/spec/lib/gitlab/graphql/loaders/pipeline_for_sha_loader_spec.rb @@ -0,0 +1,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 |