mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-08 00:03:41 -04:00
avoid ruby syntax warnings
This commit is contained in:
parent
08257d9deb
commit
a23124ea7b
@ -26,7 +26,7 @@ module Faraday
|
||||
|
||||
# Public: Gets or sets the Symbol key identifying a default Adapter to use
|
||||
# for the default Faraday::Connection.
|
||||
attr_accessor :default_adapter
|
||||
attr_reader :default_adapter
|
||||
|
||||
# Public: Sets the default Faraday::Connection for simple scripts that
|
||||
# access the Faraday constant directly.
|
||||
|
@ -5,7 +5,7 @@ module Faraday
|
||||
|
||||
def initialize(app, &block)
|
||||
super(app)
|
||||
@block = block if block_given?
|
||||
@block = block
|
||||
end
|
||||
|
||||
def call(env)
|
||||
|
@ -79,6 +79,7 @@ module Faraday
|
||||
@params.update(options.params) if options.params
|
||||
@headers.update(options.headers) if options.headers
|
||||
|
||||
@proxy = nil
|
||||
proxy(options.fetch(:proxy) { ENV['http_proxy'] })
|
||||
|
||||
yield self if block_given?
|
||||
|
@ -58,7 +58,7 @@ module Adapters
|
||||
module Compression
|
||||
def test_GET_handles_compression
|
||||
res = get('echo_header', :name => 'accept-encoding')
|
||||
assert_match /gzip;.+\bdeflate\b/, res.body
|
||||
assert_match(/gzip;.+\bdeflate\b/, res.body)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -37,9 +37,9 @@ class AuthenticationMiddlewareTest < Faraday::TestCase
|
||||
response = conn { |b|
|
||||
b.request :token_auth, 'baz', :foo => 42
|
||||
}.get('/auth-echo')
|
||||
assert_match /^Token /, response.body
|
||||
assert_match /token="baz"/, response.body
|
||||
assert_match /foo="42"/, response.body
|
||||
assert_match(/^Token /, response.body)
|
||||
assert_match(/token="baz"/, response.body)
|
||||
assert_match(/foo="42"/, response.body)
|
||||
end
|
||||
|
||||
def test_token_middleware_does_not_interfere_with_existing_authorization
|
||||
@ -52,14 +52,14 @@ class AuthenticationMiddlewareTest < Faraday::TestCase
|
||||
response = conn { |b|
|
||||
b.request :authorization, 'custom', 'abc def'
|
||||
}.get('/auth-echo')
|
||||
assert_match /^custom abc def$/, response.body
|
||||
assert_match(/^custom abc def$/, response.body)
|
||||
end
|
||||
|
||||
def test_authorization_middleware_with_hash
|
||||
response = conn { |b|
|
||||
b.request :authorization, 'baz', :foo => 42
|
||||
}.get('/auth-echo')
|
||||
assert_match /^baz /, response.body
|
||||
assert_match /foo="42"/, response.body
|
||||
assert_match(/^baz /, response.body)
|
||||
assert_match(/foo="42"/, response.body)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user