Merge branch 'master' of https://github.com/benburkert/faraday into default-fetch-fixes

This commit is contained in:
risk danger olson 2013-11-08 13:33:40 -07:00
commit 1b94e96022
2 changed files with 9 additions and 2 deletions

View File

@ -48,8 +48,9 @@ module Faraday
# Public # Public
def fetch(key, default = nil) def fetch(key, default = nil)
send(key) || send("#{key}=", default || return send(key) if keys.include?(key)
(block_given? ? Proc.new.call : nil))
send("#{key}=", default || (block_given? ? Proc.new.call : nil))
end end
# Public # Public

View File

@ -164,4 +164,10 @@ class OptionsTest < Faraday::TestCase
e["custom"] = :boom e["custom"] = :boom
assert_equal :boom, e["custom"] assert_equal :boom, e["custom"]
end end
def test_env_fetch_ignores_false
ssl = Faraday::SSLOptions.new
ssl.verify = false
assert !ssl.fetch(:verify, true)
end
end end