-
Notifications
You must be signed in to change notification settings - Fork 8
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
Generic stubs #15
Comments
Any chance of this being added? I can't tell if it's a regression in bats-mock v4. Here's a common use case to avoid having to actually sleep for 10 seconds each time: stub sleep "10 : echo sleep for 10 seconds" In our command under test, we're calling This actually worked fine in bats-mock v3, but in v4 I am required to set up 90 stub plans. |
There is a definitive non-zero chance as long as this issue is still open. Unfortunately, I can't be any more specific that that 🤷
I don't think it is a regression. Most likely it was unspecified behaviour that changed but would love to hear arguments either way
I am quite puzzled at your On the other hand, I do understand the annoyance of setting up 90 stub plans. Luckily, since #11 - thanks to @flamefire's efforts (see #7) - you can use incremental stub plans to setup 90 stub plans in a loop: for ITER in seq 90; do
stub sleep "10: echo sleep for 10 seconds #${ITER}"
done |
It is quite common to have to stub commands only for them to be called multiple times with a set of arguments that are known or small.
I believe those scenarios may be better served by generic stubs. Instead of calls defining exact and sorted matches to compare against on calls, they just define a set of patterns to match against and their corresponding replacement commands. In my idea:
The text was updated successfully, but these errors were encountered: