Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add test for fetch with a block

  • Loading branch information...
commit b2debfb005cc6d0661b24c50983a885509f7f9c9 1 parent 6ea781c
Aaron Patterson tenderlove authored
4 actionpack/lib/action_dispatch/http/headers.rb
View
@@ -17,8 +17,8 @@ def []=(k,v); @headers[k] = v; end
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)
4 actionpack/test/dispatch/header_test.rb
View
@@ -23,6 +23,10 @@ def test_key?
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"]
Please sign in to comment.
Something went wrong with that request. Please try again.