mirror of
https://github.com/rest-client/rest-client.git
synced 2022-11-09 13:49:40 -05:00
Fix test failures and deprecation warnings.
This commit is contained in:
parent
8f021b158b
commit
39a0034c3e
1 changed files with 12 additions and 9 deletions
|
@ -431,12 +431,13 @@ describe RestClient::Request do
|
||||||
describe "timeout" do
|
describe "timeout" do
|
||||||
it "does not set timeouts if not specified" do
|
it "does not set timeouts if not specified" do
|
||||||
@request = RestClient::Request.new(:method => :put, :url => 'http://some/resource', :payload => 'payload')
|
@request = RestClient::Request.new(:method => :put, :url => 'http://some/resource', :payload => 'payload')
|
||||||
@http.stub!(:request)
|
@http.stub(:request)
|
||||||
@request.stub!(:process_result)
|
@request.stub(:process_result)
|
||||||
@request.stub!(:response_log)
|
@request.stub(:response_log)
|
||||||
|
|
||||||
@net.should_not_receive(:read_timeout=)
|
@net.should_not_receive(:read_timeout=)
|
||||||
@net.should_not_receive(:open_timeout=)
|
@net.should_not_receive(:open_timeout=)
|
||||||
|
@net.should_receive(:ssl_version=).with('SSLv3')
|
||||||
|
|
||||||
@request.transmit(@uri, 'req', nil)
|
@request.transmit(@uri, 'req', nil)
|
||||||
end
|
end
|
||||||
|
@ -467,27 +468,29 @@ describe RestClient::Request do
|
||||||
|
|
||||||
it "disable timeout by setting it to nil" do
|
it "disable timeout by setting it to nil" do
|
||||||
@request = RestClient::Request.new(:method => :put, :url => 'http://some/resource', :payload => 'payload', :timeout => nil, :open_timeout => nil)
|
@request = RestClient::Request.new(:method => :put, :url => 'http://some/resource', :payload => 'payload', :timeout => nil, :open_timeout => nil)
|
||||||
@http.stub!(:request)
|
@http.stub(:request)
|
||||||
@request.stub!(:process_result)
|
@request.stub(:process_result)
|
||||||
@request.stub!(:response_log)
|
@request.stub(:response_log)
|
||||||
|
|
||||||
@net.should_receive(:read_timeout=).with(nil)
|
@net.should_receive(:read_timeout=).with(nil)
|
||||||
@net.should_receive(:open_timeout=).with(nil)
|
@net.should_receive(:open_timeout=).with(nil)
|
||||||
|
@net.should_receive(:ssl_version=).with('SSLv3')
|
||||||
|
|
||||||
@request.transmit(@uri, 'req', nil)
|
@request.transmit(@uri, 'req', nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "deprecated: disable timeout by setting it to -1" do
|
it "deprecated: disable timeout by setting it to -1" do
|
||||||
@request = RestClient::Request.new(:method => :put, :url => 'http://some/resource', :payload => 'payload', :timeout => -1, :open_timeout => -1)
|
@request = RestClient::Request.new(:method => :put, :url => 'http://some/resource', :payload => 'payload', :timeout => -1, :open_timeout => -1)
|
||||||
@http.stub!(:request)
|
@http.stub(:request)
|
||||||
@request.stub!(:process_result)
|
@request.stub(:process_result)
|
||||||
@request.stub!(:response_log)
|
@request.stub(:response_log)
|
||||||
|
|
||||||
@request.should_receive(:warn)
|
@request.should_receive(:warn)
|
||||||
@net.should_receive(:read_timeout=).with(nil)
|
@net.should_receive(:read_timeout=).with(nil)
|
||||||
|
|
||||||
@request.should_receive(:warn)
|
@request.should_receive(:warn)
|
||||||
@net.should_receive(:open_timeout=).with(nil)
|
@net.should_receive(:open_timeout=).with(nil)
|
||||||
|
@net.should_receive(:ssl_version=).with('SSLv3')
|
||||||
|
|
||||||
@request.transmit(@uri, 'req', nil)
|
@request.transmit(@uri, 'req', nil)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue