Current section

Files

Jump to
espec lib espec assertions boolean be_false.ex
Raw

lib/espec/assertions/boolean/be_false.ex

defmodule ESpec.Assertions.Boolean.BeFalse do
@moduledoc """
Defines 'be_false' assertion.
it do: expect(1 == 2).to be_false
"""
use ESpec.Assertions.Interface
defp match(subject, _val) do
result = subject === false
{result, result}
end
defp success_message(subject, _val, _result, positive) do
to = if positive, do: "is", else: "is not"
"`#{inspect subject}` #{to} false."
end
defp error_message(subject, _val, _result, positive) do
to = if positive, do: "to", else: "not to"
but = if positive, do: "it isn't", else: "it is"
"Expected `#{inspect subject}` #{to} be false but #{but}."
end
end