Created
October 21, 2016 20:03
-
-
Save lasseebert/63eee1b4eaeac88eb0461841b1a78fe2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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