Sha256: 472f2240a5dc4c09f27932457c8ab8b745c0a287b0397163b9fe1ca846f2898b
Contents?: true
Size: 1.68 KB
Versions: 4
Compression:
Stored size: 1.68 KB
Contents
require 'test_helper' class GenericControllerTest < ActionController::TestCase tests PagesController context "with a maestrano session" do setup do @original_sso_value = Maestrano.param(:sso_enabled) Maestrano.configure { |config| config.sso_enabled = true } @request.session[:mno_uid] = 'usr-1' @request.session[:mno_session] = 'fdsf544fd5sd4f' @request.session[:mno_session_recheck] = Time.now.utc.iso8601 @request.session[:mno_group_uid] = 'cld-1' end teardown do Maestrano.configure { |config| config.sso_enabled = @original_sso_value } end should "be successful if the maestrano session is still valid" do sso_session = mock('maestrano_sso_session') sso_session.stubs(:valid?).returns(true) Maestrano::SSO::Session.stubs(:new).returns(sso_session) get :home assert_response :success end should "initialize redirect to SSO initialization if invalid" do sso_session = mock('maestrano_sso_session') sso_session.stubs(:valid?).returns(false) Maestrano::SSO::Session.stubs(:new).returns(sso_session) get :home assert_redirected_to Maestrano::SSO.init_url end should "not redirect to SSO init if sso is disabled" do Maestrano.configure { |config| config.sso_enabled = false } sso_session = mock('maestrano_sso_session') sso_session.stubs(:valid?).returns(false) Maestrano::SSO::Session.stubs(:new).returns(sso_session) get :home assert_response :success end end context "with no maestrano session" do should "be successful" do get :home assert_response :success end end end
Version data entries
4 entries across 4 versions & 1 rubygems