Sha256: 7b8e6cfe7b8e1465d3485c14873d7b3881f3dca76816e475ee8622275914060e

Contents?: true

Size: 1.91 KB

Versions: 46

Compression:

Stored size: 1.91 KB

Contents

require File.dirname(__FILE__) + '/../test_helper.rb'

module SessionTest
  module ParamsTest
    class ConfigTest < ActiveSupport::TestCase
      def test_params_key
        UserSession.params_key = "my_params_key"
        assert_equal "my_params_key", UserSession.params_key
    
        UserSession.params_key "user_credentials"
        assert_equal "user_credentials", UserSession.params_key
      end
    
      def test_single_access_allowed_request_types
        UserSession.single_access_allowed_request_types = ["my request type"]
        assert_equal ["my request type"], UserSession.single_access_allowed_request_types
    
        UserSession.single_access_allowed_request_types ["application/rss+xml", "application/atom+xml"]
        assert_equal ["application/rss+xml", "application/atom+xml"], UserSession.single_access_allowed_request_types
      end
    end
    
    class InstanceMethodsTest < ActiveSupport::TestCase
      def test_persist_persist_by_params
        ben = users(:ben)
        session = UserSession.new
    
        assert !session.persisting?
        set_params_for(ben)
      
        assert !session.persisting?
        assert !session.unauthorized_record
        assert !session.record
        assert_nil controller.session["user_credentials"]
      
        set_request_content_type("text/plain")
        assert !session.persisting?
        assert !session.unauthorized_record
        assert_nil controller.session["user_credentials"]
      
        set_request_content_type("application/atom+xml")
        assert session.persisting?
        assert_equal ben, session.record
        assert_nil controller.session["user_credentials"] # should not persist since this is single access
      
        set_request_content_type("application/rss+xml")
        assert session.persisting?
        assert_equal ben, session.unauthorized_record
        assert_nil controller.session["user_credentials"]
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 14 rubygems

Version Path
authlogic-2.1.11 test/session_test/params_test.rb
authlogic-2.1.10 test/session_test/params_test.rb
binarylogic-authlogic-2.1.0 test/session_test/params_test.rb
binarylogic-authlogic-2.1.1 test/session_test/params_test.rb
crankharder-authlogic-2.1.1 test/session_test/params_test.rb
jlecour-authlogic-2.1.2 test/session_test/params_test.rb
kschrader-authlogic-2.1.2 test/session_test/params_test.rb
kschrader-authlogic-2.1.3 test/session_test/params_test.rb
authlogic-2.1.8 test/session_test/params_test.rb
authlogic-2.1.7 test/session_test/params_test.rb
expertiza-authlogic-2.1.6.1 test/session_test/params_test.rb
wulffeld_authlogic-2.1.3 test/session_test/params_test.rb
authlogic-2.1.6 test/session_test/params_test.rb
lockbox_middleware-1.2.1 vendor/gems/authlogic-2.1.3/test/session_test/params_test.rb
Empact-authlogic-2.1.5 test/session_test/params_test.rb
authlogic-2.1.5 test/session_test/params_test.rb
authlogic-2.1.4 test/session_test/params_test.rb
Empact-authlogic-2.1.4 test/session_test/params_test.rb
namxam-authlogic-2.1.3.1 test/session_test/params_test.rb
drogus-authlogic-2.1.3 test/session_test/params_test.rb