Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add support for detecting if WebMock is enabled #701
I'm encountering a use case where we would like to check if WebMock is enabled or not.
> WebMock.enabled? => false > WebMock.enable! > WebMock.enabled? => true > WebMock.disable! > WebMock.enabled? => false
The application I'm working on raises exceptions when HTTP 400+ response is received, and depending on the circumstance the exception is caught and logged with a stack trace.
When we're using WebMock, these stack traces are not needed in our logs. They're really cluttering up the TravisCI logs unnecessarily. We'd like to exclude the error or stack traces from our logs when WebMock is being used. Support for
I'm thinking of making a pull request for this myself. A simple class variable boolean that is modified in WebMock.enabled! and WebMock.disabled! is all that's needed.
Thanks for a well defined issue.
It all makes sense except the fact WebMock can be enabled only for some http clients.
Yes. You have a point.
I was also just thinking that some requests using the same adapter may be mocked, while others are not. It sounds like my request is too global to be practical for most others using this library.
Someone could use