aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/session/mem_cache_store_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch/session/mem_cache_store_test.rb')
-rw-r--r--actionpack/test/dispatch/session/mem_cache_store_test.rb31
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