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:
Diffstat (limited to 'spec/support/graphql')
-rw-r--r--spec/support/graphql/field_inspection.rb2
-rw-r--r--spec/support/graphql/field_selection.rb8
-rw-r--r--spec/support/graphql/resolver_factories.rb4
3 files changed, 5 insertions, 9 deletions
diff --git a/spec/support/graphql/field_inspection.rb b/spec/support/graphql/field_inspection.rb
index e5fe37ec555..8730f82b893 100644
--- a/spec/support/graphql/field_inspection.rb
+++ b/spec/support/graphql/field_inspection.rb
@@ -20,7 +20,7 @@ module Graphql
def type
@type ||= begin
- field_type = @field.type.respond_to?(:to_graphql) ? @field.type.to_graphql : @field.type
+ field_type = @field.type
# The type could be nested. For example `[GraphQL::Types::String]`:
# - List
diff --git a/spec/support/graphql/field_selection.rb b/spec/support/graphql/field_selection.rb
index 00323c46d69..432340cfdb5 100644
--- a/spec/support/graphql/field_selection.rb
+++ b/spec/support/graphql/field_selection.rb
@@ -46,7 +46,7 @@ module Graphql
NO_SKIP = ->(_name, _field) { false }
- def self.select_fields(type, skip = NO_SKIP, parent_types = Set.new, max_depth = 3)
+ def self.select_fields(type, skip = NO_SKIP, max_depth = 3)
return new if max_depth <= 0 || !type.kind.fields?
new(type.fields.flat_map do |name, field|
@@ -55,12 +55,8 @@ module Graphql
inspected = ::Graphql::FieldInspection.new(field)
singular_field_type = inspected.type
- # If field type is the same as parent type, then we're hitting into
- # mutual dependency. Break it from infinite recursion
- next [] if parent_types.include?(singular_field_type)
-
if inspected.nested_fields?
- subselection = select_fields(singular_field_type, skip, parent_types | [type], max_depth - 1)
+ subselection = select_fields(singular_field_type, skip, max_depth - 1)
next [] if subselection.empty?
[[name, subselection.to_h]]
diff --git a/spec/support/graphql/resolver_factories.rb b/spec/support/graphql/resolver_factories.rb
index 8188f17cc43..3c5aad34e8b 100644
--- a/spec/support/graphql/resolver_factories.rb
+++ b/spec/support/graphql/resolver_factories.rb
@@ -15,8 +15,8 @@ module Graphql
private
- def simple_resolver(resolved_value = 'Resolved value')
- Class.new(Resolvers::BaseResolver) do
+ def simple_resolver(resolved_value = 'Resolved value', base_class: Resolvers::BaseResolver)
+ Class.new(base_class) do
define_method :resolve do |**_args|
resolved_value
end