class Challah::TestSessionStore

Used to persist session data in test mode instead of using cookies. Stores the session data lazily in a global var, accessible across the testing environment.

Public Class Methods

new(session = nil) click to toggle source
# File lib/challah/test.rb, line 5
def initialize(session = nil)
  @session = session
end

Public Instance Methods

destroy() click to toggle source
# File lib/challah/test.rb, line 9
def destroy
  $challah_test_session = nil
end
read() click to toggle source
# File lib/challah/test.rb, line 13
def read
  if $challah_test_session
    return $challah_test_session.to_s.split("@")
  end

  nil
end
save(token, user_id) click to toggle source
# File lib/challah/test.rb, line 21
def save(token, user_id)
  $challah_test_session = "#{ token }@#{ user_id }"
  true
end