You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with_mocks successfully mocks a function in a module (separate from the testing module) that is called from a function in the same module.
Current Behavior
The function is not mocked
Steps to Reproduce
git clone https://github.com/LLay/mock_test.git
mix deps.get
mix test
Result should be:
$ mix test
.
1) test bar is mocked when called from own module (MockerTest)
test/mocker_test.exs:12
Assertion with == failed
code: assert Mocker.foo() == :mocked
left: :bar
right: :mocked
stacktrace:
test/mocker_test.exs:14: (test)
Finished in 0.06 seconds
2 tests, 1 failure
MacBook-Pro:mocker user1$ asdf current
elixir 1.6.5
erlang 20.2.3
Conversation
I'm guessing this behavior is occurring because the caller function (foo in my example) is compiled before the mocked version of function in question (bar) is. Is there any way around this?
Note that this is not an issue with :passthrough. Removing this option only leads to the caller (foo) being undefined
The text was updated successfully, but these errors were encountered:
Expected Behavior
with_mocks
successfully mocks a function in a module (separate from the testing module) that is called from a function in the same module.Current Behavior
The function is not mocked
Steps to Reproduce
Result should be:
Context (Environment)
Demo (from above): https://github.com/LLay/mock_test
Conversation
I'm guessing this behavior is occurring because the caller function (foo in my example) is compiled before the mocked version of function in question (bar) is. Is there any way around this?
Note that this is not an issue with :passthrough. Removing this option only leads to the caller (foo) being undefined
The text was updated successfully, but these errors were encountered: