Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def f_login(session_stubs = {}, user_stubs = {})
- UserSession.stub(:find).and_return(f_user_session(session_stubs, user_stubs))
- end
- def f_user_session(stubs = {}, user_stubs = {})
- @current_user_session ||= mock(UserSession, {:user => f_current_user(user_stubs).merge(stubs)})
- end
- def f_current_user(stubs = {})
- @current_user ||= mock(User, stubs)
- end
- def f_logout
- @current_user_session = nil
- end
Add Comment
Please, Sign In to add comment