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>2020-01-09 00:08:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-09 00:08:08 +0300
commite0b84f4ba4b44c8ecf00be97843c40df2550b74c (patch)
tree7cecae4276358dd46d7fa15f84068f7b4c626089 /spec/graphql/gitlab_schema_spec.rb
parent73391dcc368ef846c2960c1d0ef5e64ca78e1bee (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql/gitlab_schema_spec.rb')
-rw-r--r--spec/graphql/gitlab_schema_spec.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/graphql/gitlab_schema_spec.rb b/spec/graphql/gitlab_schema_spec.rb
index dcf3c989047..2ec477fc494 100644
--- a/spec/graphql/gitlab_schema_spec.rb
+++ b/spec/graphql/gitlab_schema_spec.rb
@@ -124,14 +124,26 @@ describe GitlabSchema do
describe '.object_from_id' do
context 'for subclasses of `ApplicationRecord`' do
- it 'returns the correct record' do
- user = create(:user)
+ let_it_be(:user) { create(:user) }
+ it 'returns the correct record' do
result = described_class.object_from_id(user.to_global_id.to_s)
expect(result.sync).to eq(user)
end
+ it 'returns the correct record, of the expected type' do
+ result = described_class.object_from_id(user.to_global_id.to_s, expected_type: ::User)
+
+ expect(result.sync).to eq(user)
+ end
+
+ it 'fails if the type does not match' do
+ expect do
+ described_class.object_from_id(user.to_global_id.to_s, expected_type: ::Project)
+ end.to raise_error(Gitlab::Graphql::Errors::ArgumentError)
+ end
+
it 'batchloads the queries' do
user1 = create(:user)
user2 = create(:user)