Skip to content

Instantly share code, notes, and snippets.

@ihumanable
Created November 23, 2021 00:31
Show Gist options
  • Save ihumanable/ecbbe83e1add3b5f584b999cdaa6e053 to your computer and use it in GitHub Desktop.
Save ihumanable/ecbbe83e1add3b5f584b999cdaa6e053 to your computer and use it in GitHub Desktop.
Discord Test with Mock: Attempt 2 (Added :passthrough)
defmodule Discord.Test do
use ExUnit.Case
import Mock
describe "send_message/1" do
test "errors on invalid messages" do
with_mock Discord, [:passthrough], [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