Test with warnings enabled, fix some warnings.

This commit is contained in:
Andy Brody 2016-06-05 20:31:17 -04:00
parent aaeab33184
commit 7b512f23c5
5 changed files with 13 additions and 4 deletions

View File

@ -94,7 +94,7 @@ module RestClient
# A global proxy URL to use for all requests. This can be overridden on a
# per-request basis by passing `:proxy` to RestClient::Request.
def self.proxy
@proxy
@proxy ||= nil
end
def self.proxy=(value)
@proxy = value

View File

@ -64,7 +64,7 @@ module RestClient
# @return [HTTP::CookieJar]
#
def cookie_jar
return @cookie_jar if @cookie_jar
return @cookie_jar if defined?(@cookie_jar) && @cookie_jar
jar = @request.cookie_jar.dup
headers.fetch(:set_cookie, []).each do |cookie|

View File

@ -174,7 +174,7 @@ module RestClient
end
def boundary
return @boundary if @boundary
return @boundary if defined?(@boundary) && @boundary
# Use the same algorithm used by WebKit: generate 16 random
# alphanumeric characters, replacing `+` `/` with `A` `B` (included in

View File

@ -124,6 +124,8 @@ module RestClient
else
raise ArgumentError, "must pass :url"
end
@user = @password = nil
parse_url_with_auth!(url)
# process cookie arguments found in headers or args
@ -815,7 +817,7 @@ module RestClient
# Kudos to _why!
@tf = Tempfile.new('rest-client.')
@tf.binmode
size, total = 0, http_response.header['Content-Length'].to_i
size, total = 0, http_response['Content-Length'].to_i
http_response.read_body do |chunk|
@tf.write chunk
size += chunk.size

View File

@ -13,6 +13,10 @@ RSpec.configure do |config|
# --seed 1234
config.order = 'random'
# always run with ruby warnings enabled
# TODO: figure out why this is so obscenely noisy (rspec bug?)
# config.warnings = true
# add helpers
config.include Helpers, :include_helpers
@ -20,3 +24,6 @@ RSpec.configure do |config|
mocks.yield_receiver_to_any_instance_implementation_blocks = true
end
end
# always run with ruby warnings enabled (see above)
$VERBOSE = true