lib/rspec/graphql_matchers/implement.rb in rspec-graphql_matchers-1.0.0.pre.0.1 vs lib/rspec/graphql_matchers/implement.rb in rspec-graphql_matchers-1.0

- old
+ new

@@ -1,12 +1,12 @@ require_relative 'base_matcher' module RSpec module GraphqlMatchers class Implement < BaseMatcher - def initialize(interface_names) - @expected = interface_names.map(&:to_s) + def initialize(interfaces) + @expected = interfaces.map {|interface| interface_name(interface) } end def matches?(graph_object) @graph_object = graph_object @actual = actual @@ -31,16 +31,16 @@ private def actual if @graph_object.respond_to?(:interfaces) - @graph_object.interfaces.map do |interface| + return @graph_object.interfaces.map do |interface| interface_name(interface) end - else - raise "Invalid object #{@graph_object} provided to #{matcher_name} " \ - 'matcher. It does not seem to be a valid GraphQL object type.' end + + raise "Invalid object #{@graph_object} provided to #{matcher_name} " \ + 'matcher. It does not seem to be a valid GraphQL object type.' end def interface_name(interface) return interface.graphql_name if interface.respond_to?(:graphql_name)