Do not swallow exception on NameError within constant.

Fixes https://github.com/rails/rails/issues/9933.
I had to add this in otherwise the methods in `core_ext` would not be available when we run the test individually.