Sha256: b06ec5da5f43adbb48ebcb7bef79d0e9aaa8a49728a07de9e8df284ebaaf5acd
Contents?: true
Size: 815 Bytes
Versions: 2
Compression:
Stored size: 815 Bytes
Contents
module RSpec module GraphqlMatchers module HaveAFieldMatchers class WithHashKey def initialize(expected_hash_key) @expected_hash_key = expected_hash_key end def description "with hash key `#{@expected_hash_key}`" end def matches?(actual_field) @actual_hash_key = get_hash_key(actual_field) @actual_hash_key == @expected_hash_key.to_sym end def failure_message "#{description}, but it was `#{@actual_hash_key}`" end private def get_hash_key(actual_field) if actual_field.respond_to?(:hash_key) return actual_field.hash_key.to_sym end # Class-based api actual_field.method_sym end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems