diff options
author | Tom Prats <tprats108@gmail.com> | 2016-01-30 19:30:32 -0500 |
---|---|---|
committer | Tom Prats <tprats108@gmail.com> | 2016-01-30 19:30:32 -0500 |
commit | 45a75a3fcc96b22954caf69be2df4e302b134d7a (patch) | |
tree | 1f4ef44ceb84e9aebb264c85c976cae0db661d09 /actionpack/test/dispatch/session/mem_cache_store_test.rb | |
parent | 82dc8266dddc199789f3f1e9a9f21975e1c8ee87 (diff) | |
download | rails-45a75a3fcc96b22954caf69be2df4e302b134d7a.tar.gz rails-45a75a3fcc96b22954caf69be2df4e302b134d7a.tar.bz2 rails-45a75a3fcc96b22954caf69be2df4e302b134d7a.zip |
Update Session to utilize indiffernt access
Diffstat (limited to 'actionpack/test/dispatch/session/mem_cache_store_test.rb')
-rw-r--r-- | actionpack/test/dispatch/session/mem_cache_store_test.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/session/mem_cache_store_test.rb b/actionpack/test/dispatch/session/mem_cache_store_test.rb index 3fed9bad4f..2e6b42856f 100644 --- a/actionpack/test/dispatch/session/mem_cache_store_test.rb +++ b/actionpack/test/dispatch/session/mem_cache_store_test.rb @@ -13,6 +13,11 @@ class MemCacheStoreTest < ActionDispatch::IntegrationTest head :ok end + def set_deep_session_value + session[:foo] = { bar: "baz" } + head :ok + end + def set_serialized_session_value session[:foo] = SessionAutoloadTest::Foo.new head :ok @@ -22,6 +27,14 @@ class MemCacheStoreTest < ActionDispatch::IntegrationTest render plain: "foo: #{session[:foo].inspect}" end + def get_deep_session_value_with_symbol + render plain: "foo: { bar: #{session[:foo][:bar].inspect} }" + end + + def get_deep_session_value_with_string + render plain: "foo: { \"bar\" => #{session[:foo]["bar"].inspect} }" + end + def get_session_id render plain: "#{request.session.id}" end @@ -179,6 +192,24 @@ class MemCacheStoreTest < ActionDispatch::IntegrationTest rescue Dalli::RingError => ex skip ex.message, ex.backtrace end + + def test_previous_session_has_indifferent_access + with_test_route_set do + get '/set_deep_session_value' + assert_response :success + assert cookies['_session_id'] + + get '/get_deep_session_value_with_symbol' + assert_response :success + assert_equal 'foo: { bar: "baz" }', response.body + + get '/get_deep_session_value_with_string' + assert_response :success + assert_equal 'foo: { "bar" => "baz" }', response.body + end + rescue Dalli::RingError => ex + skip ex.message, ex.backtrace + end rescue LoadError, RuntimeError, Dalli::DalliError $stderr.puts "Skipping MemCacheStoreTest tests. Start memcached and try again." end |