Sha256: 96d842cfe701b42295cab19d1dbddb633e3c53ef99795c84c606d3ee6a853b18

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

require 'test_helper'

module SessionTest
  module KlassTest
    class ConfigTest < ActiveSupport::TestCase
      def test_authenticate_with
        UserSession.authenticate_with = Employee
        assert_equal "Employee", UserSession.klass_name
        assert_equal Employee, UserSession.klass

        UserSession.authenticate_with User
        assert_equal "User", UserSession.klass_name
        assert_equal User, UserSession.klass
      end

      def test_klass
        assert_equal User, UserSession.klass
      end

      def test_klass_name
        assert_equal "User", UserSession.klass_name
      end

      def test_klass_name_uses_custom_name
        assert_equal "User", UserSession.klass_name
        assert_equal "BackOfficeUser", BackOfficeUserSession.klass_name
      end
    end

    class InstanceMethodsTest < ActiveSupport::TestCase
      def test_record_method
        ben = users(:ben)
        set_session_for(ben)
        session = UserSession.find
        assert_equal ben, session.record
        assert_equal ben, session.user
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
authlogic-3.4.6 test/session_test/klass_test.rb
authlogic-3.4.5 test/session_test/klass_test.rb
authlogic-3.4.4 test/session_test/klass_test.rb
authlogic-3.4.3 test/session_test/klass_test.rb
authlogic-3.4.2 test/session_test/klass_test.rb
authlogic-3.4.1 test/session_test/klass_test.rb
authlogic-3.4.0 test/session_test/klass_test.rb
authlogic-3.3.0 test/session_test/klass_test.rb
authlogic-3.2.0 test/session_test/klass_test.rb
authlogic-3.1.3 test/session_test/klass_test.rb
authlogic-3.1.2 test/session_test/klass_test.rb
authlogic-3.1.1 test/session_test/klass_test.rb
nulogy-authlogic-3.1.0.1 test/session_test/klass_test.rb
Empact-authlogic-3.1.0 test/session_test/klass_test.rb
authlogic-3.1.0 test/session_test/klass_test.rb