diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-07-10 05:52:18 +0000 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2019-07-10 05:52:18 +0000 |
commit | 810df4fb51bf3db4016c5f7458599331d4586300 (patch) | |
tree | 6d034939842822b4173d99df698aed00a47fbe68 /spec/graphql/gitlab_schema_spec.rb | |
parent | 227d8b4445fa1257b525945a34a2e301369736a4 (diff) | |
parent | 073c8b25ea36b6b96eab05eb675e8726b1d5318e (diff) | |
download | gitlab-ce-810df4fb51bf3db4016c5f7458599331d4586300.tar.gz |
Merge branch '62826-graphql-note-mutations' into 'master'
GraphQL mutations for managing Notes
See merge request gitlab-org/gitlab-ce!30210
Diffstat (limited to 'spec/graphql/gitlab_schema_spec.rb')
-rw-r--r-- | spec/graphql/gitlab_schema_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/graphql/gitlab_schema_spec.rb b/spec/graphql/gitlab_schema_spec.rb index 93b86b9b812..dec6b23d72a 100644 --- a/spec/graphql/gitlab_schema_spec.rb +++ b/spec/graphql/gitlab_schema_spec.rb @@ -143,6 +143,26 @@ describe GitlabSchema do end end + context 'for classes that are not ActiveRecord subclasses and have implemented .lazy_find' do + it 'returns the correct record' do + note = create(:discussion_note_on_merge_request) + + result = described_class.object_from_id(note.to_global_id) + + expect(result.__sync).to eq(note) + end + + it 'batchloads the queries' do + note1 = create(:discussion_note_on_merge_request) + note2 = create(:discussion_note_on_merge_request) + + expect do + [described_class.object_from_id(note1.to_global_id), + described_class.object_from_id(note2.to_global_id)].map(&:__sync) + end.not_to exceed_query_limit(1) + end + end + context 'for other classes' do # We cannot use an anonymous class here as `GlobalID` expects `.name` not # to return `nil` |