Class: Authlogic::TestCase::MockCookieJar

Inherits:
Hash
  • Object
show all
Defined in:
lib/authlogic/test_case/mock_cookie_jar.rb

Overview

A mock of ‘ActionDispatch::Cookies::CookieJar`. See action_dispatch/middleware/cookies.rb

Direct Known Subclasses

MockEncryptedCookieJar, MockSignedCookieJar

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#set_cookiesObject

:nodoc:



8
9
10
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 8

def set_cookies
  @set_cookies
end

Instance Method Details

#[](key) ⇒ Object



10
11
12
13
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 10

def [](key)
  hash = super
  hash && hash[:value]
end

#[]=(key, options) ⇒ Object

options as documented above [in action_dispatch/middleware/cookies.rb]“

Parameters:

  • options
    • “the cookie’s value [usually a string] or a hash of



17
18
19
20
21
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 17

def []=(key, options)
  opt = cookie_options_to_hash(options)
  (@set_cookies ||= {})[key.to_s] = opt
  super(key, opt)
end

#delete(key, _options = {}) ⇒ Object



23
24
25
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 23

def delete(key, _options = {})
  super(key)
end

#encryptedObject



31
32
33
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 31

def encrypted
  @encrypted ||= MockEncryptedCookieJar.new(self)
end

#signedObject



27
28
29
# File 'lib/authlogic/test_case/mock_cookie_jar.rb', line 27

def signed
  @signed ||= MockSignedCookieJar.new(self)
end