mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
add test for fetch with a block
This commit is contained in:
parent
6ea781c9a7
commit
b2debfb005
2 changed files with 6 additions and 2 deletions
|
@ -17,8 +17,8 @@ module ActionDispatch
|
|||
def key?(k); @headers.key? k; end
|
||||
alias :include? :key?
|
||||
|
||||
def fetch(header_name, default=nil, &block)
|
||||
@headers.fetch env_name(header_name), default, &block
|
||||
def fetch(header_name, *args, &block)
|
||||
@headers.fetch env_name(header_name), *args, &block
|
||||
end
|
||||
|
||||
def each(&block)
|
||||
|
|
|
@ -23,6 +23,10 @@ class HeaderTest < ActiveSupport::TestCase
|
|||
assert @headers.include?('HTTP_CONTENT_TYPE')
|
||||
end
|
||||
|
||||
def test_fetch_with_block
|
||||
assert_equal 'omg', @headers.fetch('notthere') { 'omg' }
|
||||
end
|
||||
|
||||
test "content type" do
|
||||
assert_equal "text/plain", @headers["Content-Type"]
|
||||
assert_equal "text/plain", @headers["content-type"]
|
||||
|
|
Loading…
Reference in a new issue