Sha256: 9c00090096deaabd8acc05af0e5694241d33309f3cd9a76e48ce88ccaf3ebda7
Contents?: true
Size: 832 Bytes
Versions: 3
Compression:
Stored size: 832 Bytes
Contents
# frozen_string_literal: true module RSpec module GraphqlMatchers module HaveAFieldMatchers class WithProperty def initialize(expected_property_name) @expected_property_name = expected_property_name end def description "resolving with property `#{@expected_property_name}`" end def matches?(actual_field) @actual_property = property(actual_field).to_sym @actual_property == @expected_property_name.to_sym end def failure_message "#{description}, but it was `#{@actual_property}`" end private def property(field) property = field.property property = field.metadata[:type_class].method_sym if property.nil? property end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems