Ensures timeouts given to Typhoeus are Integers - Fixes #753
This commit is contained in:
@@ -82,7 +82,7 @@ class Browser
|
|||||||
#
|
#
|
||||||
# @return [ void ]
|
# @return [ void ]
|
||||||
def request_timeout=(timeout)
|
def request_timeout=(timeout)
|
||||||
@request_timeout = timeout
|
@request_timeout = timeout.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sets the connect timeout
|
# Sets the connect timeout
|
||||||
@@ -90,7 +90,7 @@ class Browser
|
|||||||
#
|
#
|
||||||
# @return [ void ]
|
# @return [ void ]
|
||||||
def connect_timeout=(timeout)
|
def connect_timeout=(timeout)
|
||||||
@connect_timeout = timeout
|
@connect_timeout = timeout.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|||||||
@@ -147,7 +147,6 @@ describe Browser do
|
|||||||
@expected = default_expectation
|
@expected = default_expectation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
context 'when @proxy' do
|
context 'when @proxy' do
|
||||||
let(:proxy) { '127.0.0.1:9050' }
|
let(:proxy) { '127.0.0.1:9050' }
|
||||||
let(:proxy_expectation) { default_expectation.merge(proxy: proxy) }
|
let(:proxy_expectation) { default_expectation.merge(proxy: proxy) }
|
||||||
@@ -166,11 +165,19 @@ describe Browser do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when @request_timeout' do
|
||||||
|
it 'gives an Integer' do
|
||||||
|
browser.request_timeout = '10'
|
||||||
|
|
||||||
|
@expected = default_expectation.merge(timeout: 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when @basic_auth' do
|
context 'when @basic_auth' do
|
||||||
it 'appends the basic_auth' do
|
it 'appends the basic_auth' do
|
||||||
browser.basic_auth = 'user:pass'
|
browser.basic_auth = 'user:pass'
|
||||||
@expected = default_expectation.merge(
|
@expected = default_expectation.merge(
|
||||||
headers: default_expectation[:headers].merge('Authorization' => 'Basic '+Base64.encode64('user:pass').chomp)
|
headers: default_expectation[:headers].merge('Authorization' => 'Basic ' + Base64.encode64('user:pass').chomp)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user