From 1ec85cf9d8a6ad36c3c40cc08a0c7d8407e4b080 Mon Sep 17 00:00:00 2001 From: eileencodes Date: Fri, 26 Aug 2016 13:12:33 -0400 Subject: Missing key should throw KeyError It should not throw a NameError, but should throw a KeyError. Fixes #26278 --- actionpack/test/dispatch/header_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionpack/test/dispatch/header_test.rb') diff --git a/actionpack/test/dispatch/header_test.rb b/actionpack/test/dispatch/header_test.rb index 7a155d70cb..374e618b42 100644 --- a/actionpack/test/dispatch/header_test.rb +++ b/actionpack/test/dispatch/header_test.rb @@ -158,4 +158,10 @@ class HeaderTest < ActiveSupport::TestCase assert_equal({ "HTTP_REFERER"=>"http://example.com/", "CONTENT_TYPE"=>"text/plain" }, env) end + + test "fetch exception" do + assert_raises KeyError do + @headers.fetch(:some_key_that_doesnt_exist) + end + end end -- cgit v1.2.3