Sha256: 98491efa0dcbe9cc9cc13125eed9bcbc89c345ea0586ac98ca83ccb1a8cac6a8

Contents?: true

Size: 598 Bytes

Versions: 2

Compression:

Stored size: 598 Bytes

Contents

# frozen_string_literal: true

module RSpec
  module GraphqlMatchers
    class BaseMatcher
      private

      def member_name(member)
        member.respond_to?(:graphql_name) && member.graphql_name ||
          member.respond_to?(:name) && member.name ||
          member.inspect
      end

      def types_match?(actual_type, expected_type)
        expected_type.nil? || type_name(expected_type) == type_name(actual_type)
      end

      def type_name(a_type)
        a_type = a_type.to_type_signature if a_type.respond_to?(:to_type_signature)

        a_type.to_s
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-graphql_matchers-2.0.0.pre.rc.0 lib/rspec/graphql_matchers/base_matcher.rb
rspec-graphql_matchers-1.4.0 lib/rspec/graphql_matchers/base_matcher.rb