Sha256: 7435b6789c629956051eb56bec20819809ad7dfee213f34d1011648b651cacc6

Contents?: true

Size: 1.35 KB

Versions: 16

Compression:

Stored size: 1.35 KB

Contents

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

module SessionTests
  class SessionTest < ActiveSupport::TestCase
    def test_valid_session
      ben = users(:ben)
      session = UserSession.new
      
      assert !session.valid_session?
      
      set_session_for(ben)
      assert session.valid_session?
      assert session.find_record
      assert_equal ben, session.record
      assert_equal ben.persistence_token, @controller.session["user_credentials"]
      assert_equal ben, session.unauthorized_record
      assert !session.new_session?
    end
    
    def test_save
      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_destroy
      ben = users(:ben)
      set_session_for(ben)
      assert_equal ben.persistence_token, @controller.session["user_credentials"]
      session = UserSession.find
      assert session.destroy
      assert @controller.session["user_credentials"].blank?
    end
    
    def test_find
      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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
authlogic-1.3.1 test/session_tests/session_test.rb
authlogic-1.3.2 test/session_tests/session_test.rb
authlogic-1.2.2 test/session_tests/session_test.rb
authlogic-1.3.0 test/session_tests/session_test.rb
authlogic-1.2.1 test/session_tests/session_test.rb
authlogic-1.3.9 test/session_tests/session_test.rb
authlogic-1.4.0 test/session_tests/session_test.rb
authlogic-1.4.1 test/session_tests/session_test.rb
authlogic-1.3.3 test/session_tests/session_test.rb
authlogic-1.3.6 test/session_tests/session_test.rb
authlogic-1.3.7 test/session_tests/session_test.rb
authlogic-1.3.8 test/session_tests/session_test.rb
authlogic-1.3.4 test/session_tests/session_test.rb
authlogic-1.3.5 test/session_tests/session_test.rb
authlogic-1.4.3 test/session_tests/session_test.rb
authlogic-1.4.2 test/session_tests/session_test.rb