Skip to content
This repository was archived by the owner on Aug 17, 2017. It is now read-only.

Params.fetch covers up any KeyError raised in block. #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/parameters_basic_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'test_helper'
require 'action_controller/parameters'

class BasicParametersTest < ActiveSupport::TestCase
test 'KeyError in fetch block should not be coverd up' do
params = ActionController::Parameters.new()
err = assert_raises(KeyError){
params.fetch(:missing_key){ raise(KeyError, "key not found: :also_missing") }
}
assert_match /also_missing/, err.message
end
end