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