1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #6453 from parndt/session_keys

Added session.keys and session.values back to ActionDispatch::Request::Session
This commit is contained in:
José Valim 2012-05-22 22:49:14 -07:00
commit cb92efbf04
2 changed files with 24 additions and 0 deletions

View file

@ -87,6 +87,14 @@ module ActionDispatch
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

View file

@ -36,6 +36,22 @@ module ActionDispatch
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 {