Sha256: e01945e1a1d914434bc073ed34c4b80dd776d615b6ad90f60991ec6fee1c5bc7
Contents?: true
Size: 645 Bytes
Versions: 7
Compression:
Stored size: 645 Bytes
Contents
module RSpec module GraphqlMatchers class BeOfType attr_reader :sample, :expected def initialize(expected) @expected = expected end def matches?(actual_sample) @sample = actual_sample sample.type.to_s == @expected.to_s end def failure_message "expected field '#{field_name(sample)}' to be of type '#{expected}', " \ "but it was '#{sample.type}'" end def description "be of type '#{expected}'" end private def field_name(field) field.respond_to?(:name) && field.name || field.inspect end end end end
Version data entries
7 entries across 7 versions & 1 rubygems