rails/rails — pull request #11695 by d-Pixie (2013-08-01 07:24:04+00:00)
Title: Fixes raise in strong params super overwritten

**The original issue for this was raised over at [rails/strong_parameters](https://github.com/rails/strong_parameters/pull/156)**

When executing an `ActionController::Parameters#fetch` with a block
that raises a `KeyError` the raised `KeyError` will be rescued and
converted to an `ActionController::ParameterMissing` exception,
covering up the original exception.

This commit fixes the problem by checking if the `KeyError` message
is actually about the key requested in the call to
`ActionController::Parameters#fetch`. If it is we raise a new
`ActionController::ParameterMissing` exception and if it is not we
re-raise the original `KeyError` instead.

I could not come up with a more clever way of doing this than using
string comparison :/ Any suggestion to clean that up?

The tests might be excessive? But I wanted to have coverage of all
the possible cases. Should I have?

Any comments on the code, especially in the tests, are welcome. I
normally play with rspec, so minitest is a bit unfamiliar to me ...