Skip to content

Instantly share code, notes, and snippets.

@lasseebert
Created October 21, 2016 20:03
Show Gist options
  • Select an option

  • Save lasseebert/63eee1b4eaeac88eb0461841b1a78fe2 to your computer and use it in GitHub Desktop.

Select an option

Save lasseebert/63eee1b4eaeac88eb0461841b1a78fe2 to your computer and use it in GitHub Desktop.
defmodule MyTest do
use ExUnit.Case, async: false
import Mock
test "multiple mocks" do
with_mocks([
{HashDict,
[],
[get: fn(%{}, "http://example.com") -> "<html></html>" end]},
{String,
[],
[reverse: fn(x) -> 2*x end,
length: fn(_x) -> :ok end]}
]) do
assert HashDict.get(%{}, "http://example.com") == "<html></html>"
assert String.reverse(3) == 6
assert String.length(3) == :ok
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment