Class: Authlogic::TestCase::MockSignedCookieJar
- Inherits:
-
MockCookieJar
- Object
- Hash
- MockCookieJar
- Authlogic::TestCase::MockSignedCookieJar
- Defined in:
- lib/authlogic/test_case/mock_cookie_jar.rb
Instance Attribute Summary collapse
-
#parent_jar ⇒ Object
readonly
helper for testing.
Instance Method Summary collapse
- #[](val) ⇒ Object
- #[]=(key, options) ⇒ Object
-
#initialize(parent_jar) ⇒ MockSignedCookieJar
constructor
A new instance of MockSignedCookieJar.
Methods inherited from MockCookieJar
Constructor Details
#initialize(parent_jar) ⇒ MockSignedCookieJar
Returns a new instance of MockSignedCookieJar.
21 22 23 |
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 21 def initialize(parent_jar) @parent_jar = parent_jar end |
Instance Attribute Details
#parent_jar ⇒ Object (readonly)
helper for testing
19 20 21 |
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 19 def parent_jar @parent_jar end |
Instance Method Details
#[](val) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 25 def [](val) if = @parent_jar[val] payload, signature = .split('--') raise "Invalid signature" unless Digest::SHA1.hexdigest(payload) == signature payload end end |
#[]=(key, options) ⇒ Object
33 34 35 36 |
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 33 def []=(key, ) [:value] = "#{[:value]}--#{Digest::SHA1.hexdigest [:value]}" @parent_jar[key] = end |