Permalink
Browse files

Merge pull request #6453 from parndt/session_keys

Added session.keys and session.values back to ActionDispatch::Request::Session
  • Loading branch information...
2 parents 41cfe17 + 6ac458d commit cb92efbf0463f3b6dc0456a497556d5b414fb0e8 @josevalim josevalim committed May 23, 2012
@@ -87,6 +87,14 @@ def has_key?(key)
alias :key? :has_key?
alias :include? :has_key?
+ def keys
+ @delegate.keys
+ end
+
+ def values
+ @delegate.values
+ end
+
def []=(key, value)
load_for_write!
@delegate[key.to_s] = value
@@ -36,6 +36,22 @@ def test_find
assert_equal s, Session.find(env)
end
+ def test_keys
+ env = {}
+ s = Session.create(store, env, {})
+ s['rails'] = 'ftw'
+ s['adequate'] = 'awesome'
+ assert_equal %w[rails adequate], s.keys
+ end
+
+ def test_values
+ env = {}
+ s = Session.create(store, env, {})
+ s['rails'] = 'ftw'
+ s['adequate'] = 'awesome'
+ assert_equal %w[ftw awesome], s.values
+ end
+
private
def store
Class.new {

0 comments on commit cb92efb

Please sign in to comment.