Sha256: ef0b488267ad1c7dcf4ad6cbcd3e8556f0bc50eb3d66f828127ad10a0fd910a2
Contents?: true
Size: 913 Bytes
Versions: 5
Compression:
Stored size: 913 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
5 entries across 5 versions & 1 rubygems