diff --git a/README.md b/README.md index c250eee..f930379 100644 --- a/README.md +++ b/README.md @@ -195,10 +195,20 @@ defmodule MyTest do get: fn (%{}, "http://example.com") -> "Hello from example.com" (%{}, "http://example.org") -> "example.org says hi" + (%{}, url) -> conditionally_mocked(url) end ]) do assert Map.get(%{}, "http://example.com") == "Hello from example.com" assert Map.get(%{}, "http://example.org") == "example.org says hi" + assert Map.get(%{}, "http://example.xyz") == "Hello from example.xyz" + assert Map.get(%{}, "http://example.tech") == "example.tech says hi" + end + end + + def conditionally_mocked(url) do + cond do + String.contains?(url, ".xyz") -> "Hello from example.xyz" + String.contains?(url, ".tech") -> "example.tech says hi" end end end