Do not swallow exception on NameError within constant.

Fixes https://github.com/rails/rails/issues/9933.
In this case we should only be looking for constants declared within other constants. If we were to use `!=`, the follow scenario will fail.
* `BarTest` does not exist
* `'BarTest::index'` will return `uninitialized constant BarTest`

Therefore, the error will end up being raised. I used `>` because if a constant which is uninitialized in a module has been found, the missing name will always have the namespace of the relevant `constant_name`