Permalink
Browse files

Added ActionDispatch::Request::Session#keys and ActionDispatch::Reque…

…st::Session#values
  • Loading branch information...
1 parent d7de7a7 commit 6ac458d3417cc3dff064ddf0167d3afff6043cf9 @parndt 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 6ac458d

Please sign in to comment.