I’m trying to implement a sign in and out machinery and I’m currently have the logic in a helper
module called SessionsHelper but according to good OO and separation of concerns I want to
separate the SignIn and SignOut logic to its own module and only keep the cookies related stuff in
the SessionsHelper module (cause those are better there).
By this I’ll have perfectly fast and isolated tests for SignIn and Out module and also I’m not mixing
these all together. and finally I’ll include the SignInOut module in the SessionsHelper like the following:
def create_cookie(user_id, user_salt)
//creation of cookie
//get token from cookie
//deletion of cookie
But I want to be able to stub these methods (create_cookie etc.) in the SignInOut spec cause I want
to express some expectations in those specs for live documentation sake and other stuff too. How can
I stub module’s methods in this style? I know I can stub static methods of modules like this:
but how can I stub non-static methods of modules like these 3 methods here? I really appreciate your
help on this.
Thanks in advance for your help.