Sha256: a29a7509d6f8da11949372a6346e26ed8b73c4ab2eebb2082f2b1be182b6c8c8

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

require 'test_helper'

module SessionTest
  module ActivationTest
    class ClassMethodsTest < ActiveSupport::TestCase
      def test_activated
        assert UserSession.activated?
        Authlogic::Session::Base.controller = nil
        refute UserSession.activated?
      end

      def test_controller
        Authlogic::Session::Base.controller = nil
        assert_nil Authlogic::Session::Base.controller
        thread1 = Thread.new do
          controller = MockController.new
          Authlogic::Session::Base.controller = controller
          assert_equal controller, Authlogic::Session::Base.controller
        end
        thread1.join

        assert_nil Authlogic::Session::Base.controller

        thread2 = Thread.new do
          controller = MockController.new
          Authlogic::Session::Base.controller = controller
          assert_equal controller, Authlogic::Session::Base.controller
        end
        thread2.join

        assert_nil Authlogic::Session::Base.controller
      end
    end

    class InstanceMethodsTest < ActiveSupport::TestCase
      def test_init
        UserSession.controller = nil
        assert_raise(Authlogic::Session::Activation::NotActivatedError) { UserSession.new }
        UserSession.controller = controller
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
authlogic-4.0.1 test/session_test/activation_test.rb
authlogic-4.0.0 test/session_test/activation_test.rb
authlogic-3.8.0 test/session_test/activation_test.rb
authlogic-3.7.0 test/session_test/activation_test.rb
authlogic-3.6.1 test/session_test/activation_test.rb
authlogic-3.6.0 test/session_test/activation_test.rb