I'd like to stub https call using webmock.
Let's assume gateway url as https://some_gateway.com.
After doing:
stub_request(:post, 'https://some_gateway.com').with(body: {})
in specs.
I use Net::HTTP to generate request:
Net::HTTP.post_form(URI.parse('https://some_gateway.com'), {})
I receive problem because Webmock expects https://some_gateway.com but receives version with added port 433 so: http://www.secure.fake-payment.com:443/gateway_prod so can't see registered stub.
How can I deal with this behavior ?
Take a look at the answer for this question: WebMock: Rspec - Test Facebook Validation by using JSON response
Your code will do
httprequest with port 443 vs doing reallyhttpsAnd here you can find the answer how to do
httpsrequest using Net::HTTP Using Net::HTTP.get for an https url