diff --git a/lib/faraday.rb b/lib/faraday.rb index 27078cfa..0a681879 100644 --- a/lib/faraday.rb +++ b/lib/faraday.rb @@ -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. diff --git a/lib/faraday/adapter/patron.rb b/lib/faraday/adapter/patron.rb index 0e4d450e..34f77e68 100644 --- a/lib/faraday/adapter/patron.rb +++ b/lib/faraday/adapter/patron.rb @@ -5,7 +5,7 @@ module Faraday def initialize(app, &block) super(app) - @block = block if block_given? + @block = block end def call(env) diff --git a/lib/faraday/connection.rb b/lib/faraday/connection.rb index 1727b3c8..442f26e1 100644 --- a/lib/faraday/connection.rb +++ b/lib/faraday/connection.rb @@ -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? diff --git a/test/adapters/integration.rb b/test/adapters/integration.rb index e97d2fac..794feb6c 100644 --- a/test/adapters/integration.rb +++ b/test/adapters/integration.rb @@ -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 diff --git a/test/authentication_middleware_test.rb b/test/authentication_middleware_test.rb index 70afff2d..c497128b 100644 --- a/test/authentication_middleware_test.rb +++ b/test/authentication_middleware_test.rb @@ -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