Sha256: 539ea88857d23095f8f6642bdc97148cf4669eb31f26aa6847f6eb796262f17a
Contents?: true
Size: 914 Bytes
Versions: 7
Compression:
Stored size: 914 Bytes
Contents
module Authlogic module TestCase class MockCookieJar < Hash # :nodoc: def [](key) hash = super hash && hash[:value] end def delete(key, options = {}) super(key) end def signed @signed ||= MockSignedCookieJar.new(self) end end class MockSignedCookieJar < MockCookieJar attr_reader :parent_jar # helper for testing def initialize(parent_jar) @parent_jar = parent_jar end def [](val) if signed_message = @parent_jar[val] payload, signature = signed_message.split('--') raise "Invalid signature" unless Digest::SHA1.hexdigest(payload) == signature payload end end def []=(key, options) options[:value] = "#{options[:value]}--#{Digest::SHA1.hexdigest options[:value]}" @parent_jar[key] = options end end end end
Version data entries
7 entries across 7 versions & 1 rubygems