diff options
| author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-20 18:09:37 +0000 |
|---|---|---|
| committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-20 18:09:37 +0000 |
| commit | 4e5a71c197c67446f64ca11fc903403d3ae52983 (patch) | |
| tree | a43763cc3a0abf697b80451afcb56069aae7bcbf /spec/graphql/mutations/concerns | |
| parent | 8738992b79824278b090f08e16945affc923ff6f (diff) | |
| download | gitlab-ce-4e5a71c197c67446f64ca11fc903403d3ae52983.tar.gz | |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql/mutations/concerns')
| -rw-r--r-- | spec/graphql/mutations/concerns/mutations/finds_by_gid_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/graphql/mutations/concerns/mutations/finds_by_gid_spec.rb b/spec/graphql/mutations/concerns/mutations/finds_by_gid_spec.rb new file mode 100644 index 00000000000..37e0fd611e4 --- /dev/null +++ b/spec/graphql/mutations/concerns/mutations/finds_by_gid_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Mutations::FindsByGid do + include GraphqlHelpers + + let(:mutation_class) do + Class.new(Mutations::BaseMutation) do + authorize :read_user + + include Mutations::FindsByGid + end + end + + let(:query) { double('Query', schema: GitlabSchema) } + let(:context) { GraphQL::Query::Context.new(query: query, object: nil, values: { current_user: user }) } + let(:user) { create(:user) } + let(:gid) { user.to_global_id } + + subject(:mutation) { mutation_class.new(object: nil, context: context, field: nil) } + + it 'calls GitlabSchema.find_by_gid to find objects during authorized_find!' do + expect(mutation.authorized_find!(id: gid)).to eq(user) + end +end |
