-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiple mock #84
Comments
I think you need to add the passthrough option. There is an example in the
readme
…On Thu, Jun 21, 2018, 1:06 PM Semenets Bohdan ***@***.***> wrote:
i trying mock some function in my module. I have many functions but need
mock only some. I thy this
with_mock(AirbnbApi.PageParser, [
load_html: fn(url) -> PageParserMock.load_html(url) end,
load_user: fn(user_id, api_key) -> PageParserMock.load_user(user_id, api_key) end,
load_listings: fn(user_id, api_key) -> PageParserMock.load_listings(user_id, api_key) end
])
but when i run test it return
** (UndefinedFunctionError) function AirbnbApi.PageParser.validate/1 is undefined or private. Did you mean one of:
* validate/1
when i try
with_mocks([
{AirbnbApi.PageParser, [], [load_html: fn(url) -> PageParserMock.load_html(url) end]},
{AirbnbApi.PageParser, [], [load_user: fn(user_id, api_key) -> PageParserMock.load_user(user_id, api_key) end]},
{AirbnbApi.PageParser, [], [load_listings: fn(user_id, api_key) -> PageParserMock.load_listings(user_id, api_key) end]},
]) do
i got
** (UndefinedFunctionError) function AirbnbApi.PageParser.validate/1 is undefined (module AirbnbApi.PageParser is not available)
Why i have this behauver?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#84>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAWpXtjM3mKQKtBT0rVGS9xyYNmch3AIks5t-4w3gaJpZM4Ux79P>
.
|
passthrough option did not help me.
when i added :passthrough it start called another functions in load_html function. load_html contain Http request and i need just stub load_html and return my response |
@jjh42 Api.PageParser.validate(url) called outside this module. It called in controller |
@MeterSoft Is there still an issue? |
@Olshansk hi, yes i have the same issue on other place and project |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i trying mock some function in my module. I have many functions but need mock only some. I thy this
but when i run test it return
when i try
i got
Why i have this behauver?
The text was updated successfully, but these errors were encountered: