summaryrefslogtreecommitdiff
path: root/spec/graphql
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-13 09:08:01 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-13 09:08:01 +0000
commit17b91a3c6ab73fff087e91665e9afb8046cbf045 (patch)
tree04655a8630478d9846571875f69469f018d4bdcc /spec/graphql
parentb3db40398ce9ad335270617e834fde96d46f90ea (diff)
downloadgitlab-ce-17b91a3c6ab73fff087e91665e9afb8046cbf045.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql')
-rw-r--r--spec/graphql/resolvers/base_resolver_spec.rb26
-rw-r--r--spec/graphql/types/snippet_type_spec.rb2
2 files changed, 27 insertions, 1 deletions
diff --git a/spec/graphql/resolvers/base_resolver_spec.rb b/spec/graphql/resolvers/base_resolver_spec.rb
index a212bd07f35..0a21b2797ee 100644
--- a/spec/graphql/resolvers/base_resolver_spec.rb
+++ b/spec/graphql/resolvers/base_resolver_spec.rb
@@ -8,8 +8,12 @@ describe Resolvers::BaseResolver do
let(:resolver) do
Class.new(described_class) do
def resolve(**args)
+ process(object)
+
[args, args]
end
+
+ def process(obj); end
end
end
@@ -69,4 +73,26 @@ describe Resolvers::BaseResolver do
expect(field.to_graphql.complexity.call({}, { sort: 'foo', iids: [1, 2, 3] }, 1)).to eq 3
end
end
+
+ describe '#object' do
+ let_it_be(:user) { create(:user) }
+
+ it 'returns object' do
+ expect_next_instance_of(resolver) do |r|
+ expect(r).to receive(:process).with(user)
+ end
+
+ resolve(resolver, obj: user)
+ end
+
+ context 'when object is a presenter' do
+ it 'returns presented object' do
+ expect_next_instance_of(resolver) do |r|
+ expect(r).to receive(:process).with(user)
+ end
+
+ resolve(resolver, obj: UserPresenter.new(user))
+ end
+ end
+ end
end
diff --git a/spec/graphql/types/snippet_type_spec.rb b/spec/graphql/types/snippet_type_spec.rb
index 3c3250a5fa2..5524e7a415d 100644
--- a/spec/graphql/types/snippet_type_spec.rb
+++ b/spec/graphql/types/snippet_type_spec.rb
@@ -6,7 +6,7 @@ describe GitlabSchema.types['Snippet'] do
it 'has the correct fields' do
expected_fields = [:id, :title, :project, :author,
:file_name, :content, :description,
- :visibility, :created_at, :updated_at,
+ :visibility_level, :created_at, :updated_at,
:web_url, :raw_url, :notes, :discussions,
:user_permissions, :description_html]