1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

replaced tabs with spaces

This commit is contained in:
Shawn Pyle 2014-03-13 07:00:32 -04:00
parent 94db59f9b1
commit c0dc069908
4 changed files with 43 additions and 43 deletions

View file

@ -3,11 +3,11 @@ When /^I set my HTTParty timeout option to (\d+)$/ do |timeout|
end
When /^I set my HTTParty open_timeout option to (\d+)$/ do |timeout|
@request_options[:open_timeout] = timeout.to_i
@request_options[:open_timeout] = timeout.to_i
end
When /^I set my HTTParty read_timeout option to (\d+)$/ do |timeout|
@request_options[:read_timeout] = timeout.to_i
@request_options[:read_timeout] = timeout.to_i
end
When /I call HTTParty#get with '(.*)'$/ do |url|

View file

@ -194,8 +194,8 @@ module HTTParty
# read_timeout 10
# end
def read_timeout(t)
raise ArgumentError, 'read_timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
default_options[:read_timeout] = t
raise ArgumentError, 'read_timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
default_options[:read_timeout] = t
end
# Set an output stream for debugging, defaults to $stderr.

View file

@ -84,11 +84,11 @@ module HTTParty
end
if options[:read_timeout] && (options[:read_timeout].is_a?(Integer) || options[:read_timeout].is_a?(Float))
http.read_timeout = options[:read_timeout]
http.read_timeout = options[:read_timeout]
end
if options[:open_timeout] && (options[:open_timeout].is_a?(Integer) || options[:open_timeout].is_a?(Float))
http.open_timeout = options[:open_timeout]
if options[:open_timeout] && (options[:open_timeout].is_a?(Integer) || options[:open_timeout].is_a?(Float))
http.open_timeout = options[:open_timeout]
end
if options[:debug_output]

View file

@ -154,59 +154,59 @@ describe HTTParty::ConnectionAdapter do
end
context "when timeout is not set and read_timeout is set to 6 seconds" do
let(:options) { {:read_timeout => 6} }
let(:options) { {:read_timeout => 6} }
its(:read_timeout) { should == 6 }
its(:read_timeout) { should == 6 }
it "should not set the open_timeout" do
http = mock("http", :null_object => true)
http.should_not_receive(:open_timeout=)
Net::HTTP.stub(:new => http)
adapter.connection
end
it "should not set the open_timeout" do
http = mock("http", :null_object => true)
http.should_not_receive(:open_timeout=)
Net::HTTP.stub(:new => http)
adapter.connection
end
end
context "when timeout is set and read_timeout is set to 6 seconds" do
let(:options) { {:timeout => 5, :read_timeout => 6} }
let(:options) { {:timeout => 5, :read_timeout => 6} }
its(:open_timeout) { should == 5 }
its(:read_timeout) { should == 6 }
its(:open_timeout) { should == 5 }
its(:read_timeout) { should == 6 }
it "should override the timeout option" do
http = mock("http", :null_object => true)
http.should_receive(:open_timeout=)
http.should_receive(:read_timeout=).twice
Net::HTTP.stub(:new => http)
adapter.connection
end
it "should override the timeout option" do
http = mock("http", :null_object => true)
http.should_receive(:open_timeout=)
http.should_receive(:read_timeout=).twice
Net::HTTP.stub(:new => http)
adapter.connection
end
end
context "when timeout is not set and open_timeout is set to 7 seconds" do
let(:options) { {:open_timeout => 7} }
let(:options) { {:open_timeout => 7} }
its(:open_timeout) { should == 7 }
its(:open_timeout) { should == 7 }
it "should not set the read_timeout" do
http = mock("http", :null_object => true)
http.should_not_receive(:read_timeout=)
Net::HTTP.stub(:new => http)
adapter.connection
end
it "should not set the read_timeout" do
http = mock("http", :null_object => true)
http.should_not_receive(:read_timeout=)
Net::HTTP.stub(:new => http)
adapter.connection
end
end
context "when timeout is set and open_timeout is set to 7 seconds" do
let(:options) { {:timeout => 5, :open_timeout => 7} }
let(:options) { {:timeout => 5, :open_timeout => 7} }
its(:open_timeout) { should == 7 }
its(:read_timeout) { should == 5 }
its(:open_timeout) { should == 7 }
its(:read_timeout) { should == 5 }
it "should override the timeout option" do
http = mock("http", :null_object => true)
http.should_receive(:open_timeout=).twice
http.should_receive(:read_timeout=)
Net::HTTP.stub(:new => http)
adapter.connection
end
it "should override the timeout option" do
http = mock("http", :null_object => true)
http.should_receive(:open_timeout=).twice
http.should_receive(:read_timeout=)
Net::HTTP.stub(:new => http)
adapter.connection
end
end
context "when debug_output" do