Skip to content

Instantly share code, notes, and snippets.

@Ball
Last active August 24, 2016 14:35
Show Gist options
  • Save Ball/71957c5ad5489a212213592031130262 to your computer and use it in GitHub Desktop.
Save Ball/71957c5ad5489a212213592031130262 to your computer and use it in GitHub Desktop.
defmodule SomeTest do
use ExUnit.Case
def some_function(%{arg1: "thing", arg3: _}) do
:two
end
def some_function(%{arg1: "thing", arg2: _}) do
:one
end
def some_function(_) do
:total_miss
end
test ":one was called" do
assert :one == some_function(%{arg1: "thing", arg2: 2})
end
test ":two was called" do
# fails and returns :total_miss
assert :two == some_function(%{arg1: "thing", arg3: 3})
end
end
@alexgaribay
Copy link

You don't have a method with both arg2 and arg3. You have arg1 + arg2 and arg1 + arg3.

@Ball
Copy link
Author

Ball commented Aug 24, 2016

Thank you. That seems to work. Now to figure out why my actual code isn't behaving correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment