Is there anyway for stubbing methods of a module?

Dear group,

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:

module SessionsHelper

include SignInOut

def create_cookie(user_id, user_salt)

//creation of cookie

end

def remember_token

//get token from cookie

end

def delete_cookie

//deletion of cookie

end

end

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:

SessionsHelper.stub(:static_method).and_return(“foobar”)

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.

Best Regards