class Rack::MockResponse

def identify_cookie_attributes(cookie_filling)

def identify_cookie_attributes(cookie_filling)
  cookie_bits = cookie_filling.split(';')
  cookie_attributes = Hash.new
  cookie_attributes.store('value', cookie_bits[0].strip)
  cookie_bits.each do |bit|
    if bit.include? '='
      cookie_attribute, attribute_value = bit.split('=')
      cookie_attributes.store(cookie_attribute.strip, attribute_value.strip)
      if cookie_attribute.include? 'max-age'
        cookie_attributes.store('expires', Time.now + attribute_value.strip.to_i)
      end
    end
    if bit.include? 'secure'
      cookie_attributes.store('secure', true)
    end
  end
  cookie_attributes
end