summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2019-09-04 17:42:48 +0000
committerMayra Cabrera <mcabrera@gitlab.com>2019-09-04 17:42:48 +0000
commitaa7b1cfc5b3319373a4b56c755b1fc1d4cbaff02 (patch)
treeba078b30d36bf8ed8d5ec8fece71871e40d85a2c /spec/lib
parent29e3a08b8f8f9511dd6e25566bc9abb135a597c4 (diff)
downloadgitlab-ce-aa7b1cfc5b3319373a4b56c755b1fc1d4cbaff02.tar.gz
Upgrade GraphQL gem to 1.8.17
- Due to https://github.com/exAspArk/batch-loader/pull/32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/graphql/authorize/authorize_resource_spec.rb12
-rw-r--r--spec/lib/gitlab/graphql/loaders/batch_lfs_oid_loader_spec.rb2
-rw-r--r--spec/lib/gitlab/graphql/loaders/batch_model_loader_spec.rb6
-rw-r--r--spec/lib/gitlab/graphql/loaders/pipeline_for_sha_loader_spec.rb2
4 files changed, 11 insertions, 11 deletions
diff --git a/spec/lib/gitlab/graphql/authorize/authorize_resource_spec.rb b/spec/lib/gitlab/graphql/authorize/authorize_resource_spec.rb
index 50138d272c4..23762666ba8 100644
--- a/spec/lib/gitlab/graphql/authorize/authorize_resource_spec.rb
+++ b/spec/lib/gitlab/graphql/authorize/authorize_resource_spec.rb
@@ -46,9 +46,9 @@ describe Gitlab::Graphql::Authorize::AuthorizeResource do
end
end
- describe '#authorized?' do
+ describe '#authorized_resource?' do
it 'is true' do
- expect(loading_resource.authorized?(project)).to be(true)
+ expect(loading_resource.authorized_resource?(project)).to be(true)
end
end
end
@@ -72,9 +72,9 @@ describe Gitlab::Graphql::Authorize::AuthorizeResource do
end
end
- describe '#authorized?' do
+ describe '#authorized_resource?' do
it 'is false' do
- expect(loading_resource.authorized?(project)).to be(false)
+ expect(loading_resource.authorized_resource?(project)).to be(false)
end
end
end
@@ -121,9 +121,9 @@ describe Gitlab::Graphql::Authorize::AuthorizeResource do
end
end
- describe '#authorized?' do
+ describe '#authorized_resource?' do
it 'raises a comprehensive error message' do
- expect { loading_resource.authorized?(project) }.to raise_error(error)
+ expect { loading_resource.authorized_resource?(project) }.to raise_error(error)
end
end
end
diff --git a/spec/lib/gitlab/graphql/loaders/batch_lfs_oid_loader_spec.rb b/spec/lib/gitlab/graphql/loaders/batch_lfs_oid_loader_spec.rb
index 46dd1777285..22d8aa4274a 100644
--- a/spec/lib/gitlab/graphql/loaders/batch_lfs_oid_loader_spec.rb
+++ b/spec/lib/gitlab/graphql/loaders/batch_lfs_oid_loader_spec.rb
@@ -12,7 +12,7 @@ describe Gitlab::Graphql::Loaders::BatchLfsOidLoader do
it 'batch-resolves LFS blob IDs' do
expect(Gitlab::Git::Blob).to receive(:batch_lfs_pointers).once.and_call_original
- result = batch do
+ result = batch_sync do
[blob, otherblob].map { |b| described_class.new(repository, b.id).find }
end
diff --git a/spec/lib/gitlab/graphql/loaders/batch_model_loader_spec.rb b/spec/lib/gitlab/graphql/loaders/batch_model_loader_spec.rb
index 4609593ef6a..a4bbd868558 100644
--- a/spec/lib/gitlab/graphql/loaders/batch_model_loader_spec.rb
+++ b/spec/lib/gitlab/graphql/loaders/batch_model_loader_spec.rb
@@ -9,8 +9,8 @@ describe Gitlab::Graphql::Loaders::BatchModelLoader do
issue_result = described_class.new(Issue, issue.id).find
user_result = described_class.new(User, user.id).find
- expect(issue_result.__sync).to eq(issue)
- expect(user_result.__sync).to eq(user)
+ expect(issue_result.sync).to eq(issue)
+ expect(user_result.sync).to eq(user)
end
it 'only queries once per model' do
@@ -21,7 +21,7 @@ describe Gitlab::Graphql::Loaders::BatchModelLoader do
expect do
[described_class.new(User, other_user.id).find,
described_class.new(User, user.id).find,
- described_class.new(Issue, issue.id).find].map(&:__sync)
+ described_class.new(Issue, issue.id).find].map(&:sync)
end.not_to exceed_query_limit(2)
end
end
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
index 927476cc655..136027736c3 100644
--- a/spec/lib/gitlab/graphql/loaders/pipeline_for_sha_loader_spec.rb
+++ b/spec/lib/gitlab/graphql/loaders/pipeline_for_sha_loader_spec.rb
@@ -10,7 +10,7 @@ describe Gitlab::Graphql::Loaders::PipelineForShaLoader do
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
+ result = batch_sync(max_queries: 1) do
[pipeline1.sha, pipeline3.sha].map { |sha| described_class.new(project, sha).find_last }
end