webmock
webmock copied to clipboard
Stubbing a request with any query
Currently, when I stub a request with any query, below code.
stub_request(:get, 'example.com/search')
.with(query: hash_including({}))
.and_return(status: 200)
I suggest below interface. How do you think? If you think it is not sure, please feel free to close.
stub_request(:get, 'example.com/search')
.with(query: :any)
.and_return(status: 200)
Reference
- https://github.com/bblimke/webmock/issues/693
I will close because it is inactive
Thank you @taki
Yes, that sounds like much nicer code to read 👍 As long as people get a clear error message in case they provide non String query option and also different than :any. Does anyone fancy submitting a PR? ;)
stub_request(:get, "some_url")
.with(query: hash_including)
This works for me