Use `safe_constantize`.

Fixes https://github.com/rails/rails/issues/9933.
Merge pull request #16450 from tgxworld/dont_swallow_error_when_identifying_constant_from_test_name

Do not swallow exception on NameError within constant.