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

def remember_token
//get token from cookie

def delete_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.
Best Regards

Sam Serpoosh
Software Developer:
Twitter @masihjesus

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
postedJul 16, '12 at 11:42a
activeJul 16, '12 at 11:42a

1 user in discussion

Sam Serpoosh: 1 post



site design / logo © 2023 Grokbase