Last active
December 18, 2015 21:09
-
-
Save josephwilk/5845416 to your computer and use it in GitHub Desktop.
This file contains 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 Punk do | |
def hip? do | |
true | |
end | |
def hop? do | |
hip? | |
end | |
end | |
fact "mock with an arguments" do | |
:meck.new(Punk, [:passthrough]) | |
:meck.expect(Punk, :hip?, fn -> false end) | |
Punk.hip? |> falsey | |
#Passes | |
Punk.hop? |> falsey | |
#Fails with: (UndefinedFunctionError) undefined function: Punk_meck_original.hop?/0 | |
end |
I get the following error:
$ mix test
** (CompileError) /Users/alind/Dropbox/Code/amrita/test/integration/meck_test.exs:44: function provided/2 undefined
:meck.__info__(:macros)
src/elixir_dispatch.erl:301: :elixir_dispatch.get_optional_macros/1
src/elixir_dispatch.erl:155: :elixir_dispatch.expand_require/6
src/elixir_dispatch.erl:99: :elixir_dispatch.dispatch_require/6
lists.erl:1329: :lists.mapfoldl/3
lists.erl:1330: :lists.mapfoldl/3
src/elixir_translator.erl:62: :elixir_translator.translate_each/2
src/elixir_translator.erl:610: :elixir_translator.translate_arg/2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To replicate:
Ensure Elixir is installed & atleast Erlang R16
Then run:
Failing test: https://github.com/josephwilk/amrita/blob/nested_mock/test/integration/meck_test.exs
Using Meck through Elixir I'm not sure if its some interop issue, my misunderstanding or something else.
Removing the ? had no effect.