We should have better specs for this, we should assert on the actual behavior, not on whether it doesn't raise an error. Not raising an error would be a valid spec for any code, so we should verify that the lookup actually works here. Having an implementation for example that ignores values with private hashes here would be valid according to this spec.

The best idea is probably to add a class for testing this in spec/ruby/core/hash/fixtures/classes.rb and use that to verify the behavior. In this case you'd want to specify that it retrieves the correct value from a hash.

Same comment applies to the spec for []= btw.