h2non / gock

HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽
https://pkg.go.dev/github.com/h2non/gock
MIT License
2.04k stars 106 forks source link

Ability to flush only certain mocks #76

Open dmitryrn opened 3 years ago

dmitryrn commented 3 years ago

Right now you can only flush all of the mocks, right? What if I want to flush only certain mocks because I want some mocks to remain?

The case: I've started my service before running any tests, my service fetching some URLs during tests (just by timer), so I want some mocks to remain during all tests run, but at the same time I want to flush test-mocks after each test run.

h2non commented 3 years ago

Check out: gock.Remove(mock)