Skip to content
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

Wait for a number of function calls #81

Closed
horkhe opened this issue Oct 24, 2012 · 2 comments
Closed

Wait for a number of function calls #81

horkhe opened this issue Oct 24, 2012 · 2 comments

Comments

@horkhe
Copy link
Contributor

horkhe commented Oct 24, 2012

It would be great if we could wait for a particular function of a mocked module to be called a particular number of times with particular parameters. E.g.

meck:new(some_mod, [passthrough]),
....
meck:wait_4_call(3, {some_mod, f1, [blah, '_', 10]}, 10000).

where

-spec wait_4_call(CalledTimes :: non_neg_integer(),
                  {module(), func(), args_pattern()},
                  Timeout :: erlang:timeout()) ->
        ok.

The wait_4_call should fail if the call pattern, that we are waiting upon, is not met within the time specified by Timeout.

I personally need this capability to use in my functional tests to get rid of ugly timer:sleep/1.

@eproxus
Copy link
Owner

eproxus commented Oct 24, 2012

This is a really good idea!

Maybe we could call it wait only? (Also, timeout should be optional)

@horkhe
Copy link
Contributor Author

horkhe commented Oct 24, 2012

I will start working on it as soon as finish splitting of the meck module.

eproxus added a commit that referenced this issue Aug 17, 2013
Wait for a number of calls feature (#81 / #99)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants