Skip to content

Instantly share code, notes, and snippets.

@willnet
Created February 6, 2013 01:41
Show Gist options
  • Select an option

  • Save willnet/4719471 to your computer and use it in GitHub Desktop.

Select an option

Save willnet/4719471 to your computer and use it in GitHub Desktop.
stub cookies for unit test
class StubCookies < Hash
def [](name)
super(name.to_s)
end
def []=(key, options)
if options.is_a?(Hash)
options.symbolize_keys!
else
options = { :value => options }
end
super(key.to_s, options[:value])
end
def delete(key,opts)
super(key)
end
def permanent
self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment