1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00

Stub out Netrc.read in tests (avoid ENV calls).

This fixes tests on Windows, where Netrc tries to read several differen
ENV variables like HOMEDRIVE and HOMEPATH.
This commit is contained in:
Andy Brody 2016-06-19 14:28:24 -04:00
parent 75f499aab5
commit b98798e632

View file

@ -567,7 +567,8 @@ describe RestClient::Request, :include_helpers do
allow(ENV).to receive(:[]).with("http_proxy").and_return("http://127.0.0.1")
allow(ENV).to receive(:[]).with("no_proxy").and_return(nil)
allow(ENV).to receive(:[]).with("NO_PROXY").and_return(nil)
allow(ENV).to receive(:[]).with("NETRC").and_return(nil)
allow(Netrc).to receive(:read).and_return({})
req = RestClient::Request.new(:method => :put, :url => 'http://some/resource', :payload => 'payload')
obj = req.net_http_object('host', 80)
expect(obj.proxy?).to be true