Sha256: 815bb3dc5ba842f3dd90f93729a8cdf93a236653fbe88efe1cf8282bbbb7ae04

Contents?: true

Size: 1.96 KB

Versions: 19

Compression:

Stored size: 1.96 KB

Contents

require 'test_helper'

module SessionTest
  module SessionTest
    class ConfigTest < ActiveSupport::TestCase
      def test_session_key
        UserSession.session_key = "my_session_key"
        assert_equal "my_session_key", UserSession.session_key
    
        UserSession.session_key "user_credentials"
        assert_equal "user_credentials", UserSession.session_key
      end
    end
    
    class InstanceMethodsTest < ActiveSupport::TestCase
      def test_persist_persist_by_session
        ben = users(:ben)
        set_session_for(ben)
        assert session = UserSession.find
        assert_equal ben, session.record
        assert_equal ben.persistence_token, controller.session["user_credentials"]
      end
      
      def test_persist_persist_by_session_with_token_only
        ben = users(:ben)
        set_session_for(ben)
        controller.session["user_credentials_id"] = nil
        assert session = UserSession.find
        assert_equal ben, session.record
        assert_equal ben.persistence_token, controller.session["user_credentials"]
      end
    
      def test_after_save_update_session
        ben = users(:ben)
        session = UserSession.new(ben)
        assert controller.session["user_credentials"].blank?
        assert session.save
        assert_equal ben.persistence_token, controller.session["user_credentials"]
      end
    
      def test_after_destroy_update_session
        ben = users(:ben)
        set_session_for(ben)
        assert_equal ben.persistence_token, controller.session["user_credentials"]
        assert session = UserSession.find
        assert session.destroy
        assert controller.session["user_credentials"].blank?
      end
    
      def test_after_persisting_update_session
        ben = users(:ben)
        set_cookie_for(ben)
        assert controller.session["user_credentials"].blank?
        assert UserSession.find
        assert_equal ben.persistence_token, controller.session["user_credentials"]
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 9 rubygems

Version Path
authlogic-3.2.0 test/session_test/session_test.rb
authlogic-3.1.3 test/session_test/session_test.rb
authlogic-3.1.2 test/session_test/session_test.rb
authlogic-3.1.1 test/session_test/session_test.rb
nulogy-authlogic-3.1.0.1 test/session_test/session_test.rb
Empact-authlogic-3.1.0 test/session_test/session_test.rb
authlogic-3.1.0 test/session_test/session_test.rb
Empact-authlogic-3.0.3 test/session_test/session_test.rb
antlypls-authlogic-3.0.3 test/session_test/session_test.rb
authlogic-3.0.3 test/session_test/session_test.rb
authlogic-3.0.2 test/session_test/session_test.rb
authlogic-3.0.1 test/session_test/session_test.rb
authlogic-3.0.0 test/session_test/session_test.rb
authlogic-rails3-2.2 test/session_test/session_test.rb
kb-authlogic-2.1.7 test/session_test/session_test.rb
railsware-authlogic-2.1.6.1 test/session_test/session_test.rb
cotweet-authlogic-2.1.6 test/session_test/session_test.rb
jdl-authlogic-2.1.6.2 test/session_test/session_test.rb
jdl-authlogic-2.1.6.1 test/session_test/session_test.rb