Module: RSpec::GraphqlAssistant::Matchers::MatcherHelper
- Included in:
- HaveAttributes, Include, Match
- Defined in:
- lib/rspec/graphql_assistant/matchers/matcher_helper.rb
Instance Method Summary collapse
Instance Method Details
#key_to_array(key, root) ⇒ Object
5 6 7 8 9 10 |
# 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) ⇒ Object
12 13 14 15 16 |
# 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 |