gems webmock 3.40.0

45 minutes ago
  • Add support for Curl::Multi (#535)

    Previously, WebMock didn't see requests sent with Curl::Multi. A handle added with multi.add and sent with multi.perform went to the real server, even when a stub matched it or real connections were disabled, and WebMock didn't record it.

    Now a handle that matches a stub gets the stubbed response during multi.perform, and one that is neither stubbed nor allowed raises WebMock::NetConnectNotAllowedError from multi.add. Allowed requests still run together in curb's own multi loop. WebMock records both, and WebMock.after_request callbacks get both.

    If your tests send Curl::Multi requests to real servers, stub them or allow their hosts, for example with WebMock.disable_net_connect!(allow: "api.example.com"). VCR, hooked into WebMock, now records and replays these requests too, and raises VCR::Errors::UnhandledHTTPRequestError for one that a cassette doesn't have, so record such cassettes again.

    Thanks to Todd Fisher

  • Drop curb callbacks on Curl::Easy#reset for stubbed requests, as curb does

    Previously, a callback such as on_complete, set before reset, still ran for a stubbed request made after it. Curb drops every callback on reset, so a real request didn't run it. If your tests rely on such a callback, set it again after reset.

Don't miss a new webmock release

NewReleases is sending notifications on new releases.