summaryrefslogtreecommitdiff
path: root/spec/support/helpers/graphql_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/helpers/graphql_helpers.rb')
-rw-r--r--spec/support/helpers/graphql_helpers.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/spec/support/helpers/graphql_helpers.rb b/spec/support/helpers/graphql_helpers.rb
index 8dc99e4e042..35b1b802f35 100644
--- a/spec/support/helpers/graphql_helpers.rb
+++ b/spec/support/helpers/graphql_helpers.rb
@@ -185,12 +185,13 @@ module GraphqlHelpers
end
# Fairly dumb Ruby => GraphQL rendering function. Only suitable for testing.
- # Missing support for Enums (feel free to add if you need it).
+ # Use symbol for Enum values
def as_graphql_literal(value)
case value
when Array then "[#{value.map { |v| as_graphql_literal(v) }.join(',')}]"
when Integer, Float then value.to_s
when String then "\"#{value.gsub(/"/, '\\"')}\""
+ when Symbol then value
when nil then 'null'
when true then 'true'
when false then 'false'