-
Notifications
You must be signed in to change notification settings - Fork 107
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 mocks matchers #30
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I was writing some tests for my code.
In one of my functions I was calling two APIs (for different purposes). So I needed to have two mockers. one of them(route2) should have had a matcher for the request body while the other (route1) did not. (For this, I had make two mockers with gock.New)
Then I traced an unexpected behavior. When I was calling the API to route2, the matcher registered on route1 mocker was being called.
Therefore, I looked up in the code to see the reason and I found out that there was a global variable named "Matchers" in "matcher.go". And this causes all the mockers to have the same matchers which I believe is a bug.
My test code:
The text was updated successfully, but these errors were encountered: