lib/matchers/value.ex

defmodule Matcher.Value do
  defstruct [:expected]

  import Matcher.Errors

  defimpl Matcher.Protocol do
    def match(%{expected: expected}, actual, context) do
      if expected == actual do
        {:ok, nil}
      else
        error(context, message: "mismatch: #{inspect(expected)} != #{inspect(actual)}")
      end
    end
  end
end