diff options
author | Matthew Draper <matthew@trebex.net> | 2017-05-28 17:13:24 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-28 17:13:24 +0930 |
commit | cfd2eff46c90425d96bb912d44d5e290cf523ea6 (patch) | |
tree | 84faf5ced452619e07c71a0c964ef2024839c344 /actionpack/test | |
parent | 1758292f55d2a938659b47fe19b23ced4881cfad (diff) | |
parent | 3498aacbbebb41e529b6755f4ccfdfbb84c28830 (diff) | |
download | rails-cfd2eff46c90425d96bb912d44d5e290cf523ea6.tar.gz rails-cfd2eff46c90425d96bb912d44d5e290cf523ea6.tar.bz2 rails-cfd2eff46c90425d96bb912d44d5e290cf523ea6.zip |
Merge pull request #28895 from codeforkjeff/fix-session-keys-and-values-methods
Add lazy loading to #keys and #values methods in Session
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/request/session_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/request/session_test.rb b/actionpack/test/dispatch/request/session_test.rb index 311b80ea0a..228135c547 100644 --- a/actionpack/test/dispatch/request/session_test.rb +++ b/actionpack/test/dispatch/request/session_test.rb @@ -54,6 +54,11 @@ module ActionDispatch assert_equal %w[rails adequate], s.keys end + def test_keys_with_deferred_loading + s = Session.create(store_with_data, req, {}) + assert_equal %w[sample_key], s.keys + end + def test_values s = Session.create(store, req, {}) s["rails"] = "ftw" @@ -61,6 +66,11 @@ module ActionDispatch assert_equal %w[ftw awesome], s.values end + def test_values_with_deferred_loading + s = Session.create(store_with_data, req, {}) + assert_equal %w[sample_value], s.values + end + def test_clear s = Session.create(store, req, {}) s["rails"] = "ftw" @@ -113,6 +123,14 @@ module ActionDispatch def delete_session(env, id, options); 123; end }.new end + + def store_with_data + Class.new { + def load_session(env); [1, { "sample_key" => "sample_value" }]; end + def session_exists?(env); true; end + def delete_session(env, id, options); 123; end + }.new + end end class SessionIntegrationTest < ActionDispatch::IntegrationTest |