diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-13 12:08:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-13 12:08:01 +0300 |
commit | 17b91a3c6ab73fff087e91665e9afb8046cbf045 (patch) | |
tree | 04655a8630478d9846571875f69469f018d4bdcc /spec/graphql/resolvers | |
parent | b3db40398ce9ad335270617e834fde96d46f90ea (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql/resolvers')
-rw-r--r-- | spec/graphql/resolvers/base_resolver_spec.rb | 26 |
1 files changed, 26 insertions, 0 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 |