Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added session.keys and session.values back to ActionDispatch::Request::Session #6453

Merged
merged 1 commit into from

3 participants

@parndt

No description provided.

@rafaelfranca

Could you please add test to it?

@parndt

@rafaelfranca sure; working on it.

@parndt

@rafaelfranca done; pull request updated with squashed commit.

cc @tenderlove I'll add tests for the other untested methods in a future PR so that this commit is atomic

@josevalim josevalim merged commit cb92efb into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 23, 2012
  1. @parndt
This page is out of date. Refresh to see the latest.
View
8 actionpack/lib/action_dispatch/request/session.rb
@@ -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
View
16 actionpack/test/dispatch/request/session_test.rb
@@ -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 {
Something went wrong with that request. Please try again.