Skip to content

Instantly share code, notes, and snippets.

@karlosmid
Last active February 7, 2021 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlosmid/5682c8ac83bdcaea02c982a9a4dfd777 to your computer and use it in GitHub Desktop.
Save karlosmid/5682c8ac83bdcaea02c982a9a4dfd777 to your computer and use it in GitHub Desktop.
ExKeyCDN Zone test using Mox
defmodule ExKeyCDN.ZoneTest do
use ExUnit.Case, async: true
import Mox
# Make sure mocks are verified when the test exits
setup :verify_on_exit!
describe "list/0" do
test "mock" do
expected = [
zones: [%ExKeyCDN.Zone{}, %ExKeyCDN.Zone{}],
limits: [rate_limit_remaining: "60", rate_limit: "60"]
]
ExKeyCDN.MockZone
|> expect(:list, fn -> expected end)
assert zone().list() == expected
end
end
defp zone do
Application.get_env(:exkeycdn, :zone)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment