defmodule Matcher.MapEmbeds do defstruct [:expected] defimpl Matcher.Protocol do def match(%{expected: expected}, actual) do Matcher.Utils.compare_maps(expected, actual, allow_unexpected?: true) end end end defmodule Matcher.MapEquals do defstruct [:expected] defimpl Matcher.Protocol do def match(%{expected: expected}, actual) do Matcher.Utils.compare_maps(expected, actual, allow_unexpected?: false) end end end defimpl Matcher.Protocol, for: Map do def match(expected, actual) do Matcher.match(%Matcher.MapEmbeds{expected: expected}, actual) end end