1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00

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

View file

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

View file

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

View file

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

View file

@ -13,6 +13,10 @@ RSpec.configure do |config|
# --seed 1234 # --seed 1234
config.order = 'random' 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 # add helpers
config.include Helpers, :include_helpers config.include Helpers, :include_helpers
@ -20,3 +24,6 @@ RSpec.configure do |config|
mocks.yield_receiver_to_any_instance_implementation_blocks = true mocks.yield_receiver_to_any_instance_implementation_blocks = true
end end
end end
# always run with ruby warnings enabled (see above)
$VERBOSE = true