spec/integration/request_spec.rb in rest-man-1.0.0 vs spec/integration/request_spec.rb in rest-man-1.1.0

- old
+ new

@@ -60,11 +60,11 @@ end end # verify_callback is not works well with VCR - # it "executes the verify_callback", focus: true do + # it "executes the verify_callback" do # ran_callback = false # request = RestMan::Request.new( # :method => :get, # :url => 'https://www.mozilla.org', # :verify_ssl => true, @@ -126,9 +126,21 @@ :url => 'https://www.mozilla.org', :read_timeout => 1e-10, ) expect { request.execute }.to( raise_error(RestMan::Exceptions::ReadTimeout)) + end + + it "raises WriteTimeout when it hits a write timeout via :write_timeout" do + allow_any_instance_of(Net::HTTP).to receive(:request).and_raise(Net::WriteTimeout.new) + + request = RestMan::Request.new( + :method => :post, + :url => 'https://www.mozilla.org', + :write_timeout => 1e-10, + ) + expect { request.execute }.to( + raise_error(RestMan::Exceptions::WriteTimeout)) end end end