avoid ruby syntax warnings

This commit is contained in:
Mislav Marohnić 2013-06-25 04:11:31 +02:00
parent 08257d9deb
commit a23124ea7b
5 changed files with 10 additions and 9 deletions

View File

@ -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.

View File

@ -5,7 +5,7 @@ module Faraday
def initialize(app, &block)
super(app)
@block = block if block_given?
@block = block
end
def call(env)

View File

@ -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?

View File

@ -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

View File

@ -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