class Authlogic::TestCase::MockEncryptedCookieJar
Which ActionDispatch class is this a mock of? TODO: Document as with other mocks above.
Attributes
Public Class Methods
Source
# File lib/authlogic/test_case/mock_cookie_jar.rb, line 104 def self.decrypt(str) str.unpack("U*").map(&:pred).pack("U*") end
Source
# File lib/authlogic/test_case/mock_cookie_jar.rb, line 100 def self.encrypt(str) str.unpack("U*").map(&:succ).pack("U*") end
simple caesar cipher for testing
Source
# File lib/authlogic/test_case/mock_cookie_jar.rb, line 81 def initialize(parent_jar) @parent_jar = parent_jar parent_jar.each { |k, v| self[k] = v } end
Public Instance Methods
Source
# File lib/authlogic/test_case/mock_cookie_jar.rb, line 86 def [](val) encrypted_message = @parent_jar[val] if encrypted_message self.class.decrypt(encrypted_message) end end
Source
# File lib/authlogic/test_case/mock_cookie_jar.rb, line 93 def []=(key, options) opt = cookie_options_to_hash(options) opt[:value] = self.class.encrypt(opt[:value]) @parent_jar[key] = opt end