Sha256: eb9896bbc9b9796c1b58eead613f818bdcce955bc86905dcc5c28f896f80ce3c

Contents?: true

Size: 1.66 KB

Versions: 21

Compression:

Stored size: 1.66 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[:maestrano] = Base64.encode64({
        uid: 'usr-1',
        session: 'fdsf544fd5sd4f',
        session_recheck: Time.now.utc.iso8601,
        group_uid: 'cld-1'
      }.to_json)
    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

21 entries across 21 versions & 2 rubygems

Version Path
maestrano-rails-0.15.4 test/controllers/generic_controller_test.rb
maestrano-rails-0.15.2 test/controllers/generic_controller_test.rb
maestrano-rails-0.15.1 test/controllers/generic_controller_test.rb
maestrano-rails-0.15.0 test/controllers/generic_controller_test.rb
maestrano-rails-0.14.0 test/controllers/generic_controller_test.rb
maestrano-rails-0.13.0 test/controllers/generic_controller_test.rb
maestrano-rails-0.12.0 test/controllers/generic_controller_test.rb
maestrano-rails-0.11.0 test/controllers/generic_controller_test.rb
maestrano-rails-0.10.0 test/controllers/generic_controller_test.rb
maestrano-rails-0.9.5 test/controllers/generic_controller_test.rb
maestrano-rails-0.9.4 test/controllers/generic_controller_test.rb
maestrano-rails-test-0.9.4 test/controllers/generic_controller_test.rb
maestrano-rails-test-0.9.3 test/controllers/generic_controller_test.rb
maestrano-rails-0.9.3 test/controllers/generic_controller_test.rb
maestrano-rails-0.9.2 test/controllers/generic_controller_test.rb
maestrano-rails-0.9.1 test/controllers/generic_controller_test.rb
maestrano-rails-0.9.0 test/controllers/generic_controller_test.rb
maestrano-rails-0.8.0 test/controllers/generic_controller_test.rb
maestrano-rails-0.7.0 test/controllers/generic_controller_test.rb
maestrano-rails-0.6.0 test/controllers/generic_controller_test.rb