Sha256: df9ae0efa9b79a92c72b25665b94d063b6f7414f701dfd2caea3d7e6a3c3a931

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 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_graphql if a_type.respond_to?(:to_graphql)

        a_type.to_s
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-graphql_matchers-1.3.1 lib/rspec/graphql_matchers/base_matcher.rb