问题描述:

I am using OpenAM sso login for authentication. i am also using one sdk developed by my Company that automatically detect whether the use is logged in or not and whether he is authorized to access the page using method authenticate_and_authorize(["employee","cleark"]). (This method internally makes use of cookie and unique token to know user is logged in or not and whether he is authorized to access the web page).

if the user is not logged in then this method automatically redirect the user to openAM sso login page and if the user enters correct credentials on sso login page then user will be redirected back to my web application with successful logged in .

Below is the code for the same

class ApplictionController < ActionController::Base

def general_authentication

#If user is not logged in then below line of code will redirect to sso login page

# if the user is successfully logged in then it will allow user to access web page.

authenticate_and_authorize(["employee","cleark"])

end

end

class HomeController < ApplicationController

before_action :general_authentiction

def index

end

end

My manager has asked me to write test case for this sso login page.He said I can use "mocha" gem for this. i have gone through "mocha" gem documentation but the document is not clear and i am still confused how this gem will help me to write test case for sso login page.

Please help me in writing test case for this scenario using "mocha" gem

Thanks,

相关阅读:
Top