Sha256: 6be485f2b51f31dc9c48f963f1fdeceaf5190bee83b78217490df0aca6897710

Contents?: true

Size: 829 Bytes

Versions: 4

Compression:

Stored size: 829 Bytes

Contents

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

module SessionTests
  class CookiesTest < ActiveSupport::TestCase
    def test_valid_cookie
      ben = users(:ben)
      session = UserSession.new
    
      assert !session.valid_cookie?
    
      set_cookie_for(ben)
      assert session.valid_cookie?
      assert_equal ben, session.unauthorized_record
    end
    
    def test_save
      ben = users(:ben)
      session = UserSession.new(ben)
      assert session.save
      assert_equal ben.remember_token, @controller.cookies["user_credentials"]
    end
    
    def test_destroy
      ben = users(:ben)
      set_cookie_for(ben)
      session = UserSession.find
      assert @controller.cookies["user_credentials"]
      assert session.destroy
      assert !@controller.cookies["user_credentials"]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authlogic-1.1.1 test/session_tests/cookies_test.rb
authlogic-1.1.0 test/session_tests/cookies_test.rb
authlogic-1.1.2 test/session_tests/cookies_test.rb
authlogic-1.2.0 test/session_tests/cookies_test.rb