Skip to content

Instantly share code, notes, and snippets.

@ihumanable
Last active December 2, 2021 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ihumanable/2d3fd853e36d76b3069922a63c9be14f to your computer and use it in GitHub Desktop.
Save ihumanable/2d3fd853e36d76b3069922a63c9be14f to your computer and use it in GitHub Desktop.
Discord Test with Mock: Attempt 1
defmodule Discord.Test do
use ExUnit.Case
import Mock
describe "send_message/1" do
test "errors on invalid messages" do
with_mock Discord, [validate_message: fn _ -> {:error, :bad} end] do
assert {:error, :bad} == Discord.send_message(%Message{})
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment