fix the valid? method, as defined? does not return a bool but the type of the constant

I used a rescue block because I couldn't find a way to stub the defined? method, and therefore to make the new tests pass
remove mock deprecation