VCR: Inspecting a request

Posted About 7 years ago. Visible to the public.

Using VCR Show archive.org snapshot to record communication with remote APIs is a great way to stub requests in tests. However, you may still want to look at the request data like the payload your application sent.

Using WebMock, this is simple: Make your request (which will record/play a VCR cassette), then ask WebMock about it:

expect(WebMock).to have_requested(:post, 'http://example.com').with(body: 'yolo')

Easy peasy.

Arne Hartherz
Last edit
About 7 years ago
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2017-03-03 16:16)