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/helpers/graphql_helpers.rb')
-rw-r--r--spec/support/helpers/graphql_helpers.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb
index d78c523decd..9d745f2cb70 100644
--- a/spec/support/helpers/graphql_helpers.rb
+++ b/spec/support/helpers/graphql_helpers.rb
@@ -130,11 +130,12 @@ module GraphqlHelpers
current_user: :not_given, # The current user (specified explicitly, overrides ctx[:current_user])
schema: GitlabSchema, # A specific schema instance
object_type: described_class, # The `BaseObject` type this field belongs to
- arg_style: :internal_prepared # Args are in internal format, but should use more rigorous processing
+ arg_style: :internal_prepared, # Args are in internal format, but should use more rigorous processing
+ query: nil # Query to evaluate the field
)
field = to_base_field(field, object_type)
ctx[:current_user] = current_user unless current_user == :not_given
- query = GraphQL::Query.new(schema, context: ctx.to_h)
+ query ||= GraphQL::Query.new(schema, context: ctx.to_h)
extras[:lookahead] = negative_lookahead if extras[:lookahead] == :not_given && field.extras.include?(:lookahead)
query_ctx = query.context
@@ -857,6 +858,8 @@ module GraphqlHelpers
def positive_lookahead
double(selects?: true).tap do |selection|
allow(selection).to receive(:selection).and_return(selection)
+ allow(selection).to receive(:selections).and_return(selection)
+ allow(selection).to receive(:map).and_return(double(include?: true))
end
end