Skip to content

Wait for a number of function calls #81

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

2 participants

@horkhe
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
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
horkhe commented Oct 24, 2012

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

@horkhe horkhe pushed a commit to horkhe/meck that referenced this issue Feb 20, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) 10bfb89
@horkhe horkhe pushed a commit to horkhe/meck that referenced this issue Feb 22, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) 8fde0f3
@horkhe horkhe pushed a commit to horkhe/meck that referenced this issue Feb 22, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) 483d792
@horkhe horkhe pushed a commit to horkhe/meck that referenced this issue Feb 22, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) d188c11
@horkhe horkhe added a commit to horkhe/meck that referenced this issue Mar 3, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) b7550f3
@horkhe horkhe added a commit to horkhe/meck that referenced this issue Mar 31, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) c922012
@horkhe horkhe added a commit to horkhe/meck that referenced this issue Apr 2, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) 6ea8098
@horkhe horkhe added a commit to horkhe/meck that referenced this issue Apr 21, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) bfc6ce8
@horkhe horkhe added a commit to horkhe/meck that referenced this issue Apr 21, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) 3f37ef8
@horkhe horkhe added a commit to horkhe/meck that referenced this issue Apr 21, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) 955095b
@horkhe horkhe added a commit to horkhe/meck that referenced this issue Apr 25, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) dcd061a
@aaron-thompson aaron-thompson added a commit to aaron-thompson/meck that referenced this issue Aug 16, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) 7a06b5d
@eproxus eproxus pushed a commit that closed this issue Aug 17, 2013
Maxim Vladimirsky Implement `wait for a number of calls` feature (Fixes #81) ed44176
@eproxus eproxus closed this in ed44176 Aug 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.