I’m having a problem using mock objects in development (not testing).
I have a class called User. In order to log in, User has to connect to
an external IMAP server and authenticate. I don’t want to do this during
development. So, I created a mock User in tests/mock/development that
went something like this:
require ‘models/user’
class User
def login_to_external_server
:success
end
end
In this case, it should override User’s method
‘login_to_external_server’, but maintain the rest of its functionality.
This is not the case. When I try to use it in my application, it
pretends like it knows nothing about the real user, and
login_to_external_server is the only function it knows. Am I doing
something wrong?