Class: Authlogic::TestCase::MockEncryptedCookieJar
Instance Attribute Summary collapse
#set_cookies
Class Method Summary
collapse
Instance Method Summary
collapse
#delete, #encrypted, #signed
Constructor Details
63
64
65
66
|
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 63
def initialize(parent_jar)
@parent_jar = parent_jar
parent_jar.each { |k, v| self[k] = v }
end
|
Instance Attribute Details
#parent_jar ⇒ Object
61
62
63
|
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 61
def parent_jar
@parent_jar
end
|
Class Method Details
.decrypt(str) ⇒ Object
85
86
87
|
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 85
def self.decrypt(str)
str.unpack("U*").map(&:pred).pack("U*")
end
|
.encrypt(str) ⇒ Object
simple caesar cipher for testing
81
82
83
|
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 81
def self.encrypt(str)
str.unpack("U*").map(&:succ).pack("U*")
end
|
Instance Method Details
#[](val) ⇒ Object
68
69
70
71
72
73
|
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 68
def [](val)
encrypted_message = @parent_jar[val]
if encrypted_message
self.class.decrypt(encrypted_message)
end
end
|
#[]=(key, options) ⇒ Object
75
76
77
78
|
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 75
def []=(key, options)
options[:value] = self.class.encrypt(options[:value])
@parent_jar[key] = options
end
|