Class: Authentication::Logic::TestCase::MockCookieJar

Inherits:
Hash
  • Object
show all
Defined in:
lib/auth/logic/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:



9
10
11
# File 'lib/auth/logic/test_case/mock_cookie_jar.rb', line 9

def set_cookies
  @set_cookies
end

Instance Method Details

#[](key) ⇒ Object



11
12
13
14
# File 'lib/auth/logic/test_case/mock_cookie_jar.rb', line 11

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



18
19
20
21
22
# File 'lib/auth/logic/test_case/mock_cookie_jar.rb', line 18

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

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



24
25
26
# File 'lib/auth/logic/test_case/mock_cookie_jar.rb', line 24

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

#encryptedObject



32
33
34
# File 'lib/auth/logic/test_case/mock_cookie_jar.rb', line 32

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

#signedObject



28
29
30
# File 'lib/auth/logic/test_case/mock_cookie_jar.rb', line 28

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