Sha256: 7e358359fef68a3fd991324095b09a4fbfb32c4b9cc30a34448b93040c912759

Contents?: true

Size: 553 Bytes

Versions: 6

Compression:

Stored size: 553 Bytes

Contents

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

6 entries across 6 versions & 1 rubygems

Version Path
rspec-graphql_matchers-1.3.0 lib/rspec/graphql_matchers/base_matcher.rb
rspec-graphql_matchers-1.2.1 lib/rspec/graphql_matchers/base_matcher.rb
rspec-graphql_matchers-1.2 lib/rspec/graphql_matchers/base_matcher.rb
rspec-graphql_matchers-1.1 lib/rspec/graphql_matchers/base_matcher.rb
rspec-graphql_matchers-1.0.1 lib/rspec/graphql_matchers/base_matcher.rb
rspec-graphql_matchers-1.0 lib/rspec/graphql_matchers/base_matcher.rb