module RSpec::GraphqlAssistant::Matchers::MatcherHelper

Public Instance Methods

key_to_array(key, root) click to toggle source
# File lib/rspec/graphql_assistant/matchers/matcher_helper.rb, line 5
def key_to_array(key, root)
  if key.is_a?(Array)
    return ([root] + key).map { |el| el.to_s.camelize(:lower) }
  end
  ([root] + [key]).map { |el| el.to_s.camelize(:lower) }
end
lookup_value(actual) click to toggle source
# File lib/rspec/graphql_assistant/matchers/matcher_helper.rb, line 12
def lookup_value(actual)
  actual_copy = actual.with_indifferent_access
  keys_to_dig = key_to_array(key, root)
  actual_copy.dig(*keys_to_dig)
end