Created
July 26, 2010 09:23
-
-
Save chrisroos/490352 to your computer and use it in GitHub Desktop.
Monkey patching soap4r to force it to use net/http so that we can mock/stub requests with Fakeweb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HTTPStreamHandler will use httpclient if installed (which it will be if you've installed soap4r as a gem, as httpclient is listed as a dependency) and fall back to net/http if it's not. We want to force net/http so that we can use FakeWeb. This hack is pretty crappy because it relies on the implementation of Soap4r but it works so is good enough for now. | |
def force_soap4r_to_use_net_http! | |
require 'soap/netHttpClient' | |
SOAP::HTTPStreamHandler.send :remove_const, :Client | |
SOAP::HTTPStreamHandler.const_set(:Client, SOAP::NetHttpClient) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment