You need to start a memcached server inorder to run these tests
Namespace
Methods
- S
- T
-
- test_can_call_deprecated_escape_key,
- test_deserializes_unloaded_class,
- test_doesnt_write_session_cookie_if_session_id_is_already_exists,
- test_getting_from_nonexistent_session,
- test_getting_nil_session_value,
- test_getting_session_id,
- test_getting_session_value_after_session_reset,
- test_local_cache_raw_values,
- test_local_cache_raw_values_with_marshal,
- test_prevents_session_fixation,
- test_raw_values,
- test_raw_values_with_marshal,
- test_read_should_return_a_different_object_id_each_time_it_is_called,
- test_setting_and_getting_session_value,
- test_setting_session_value_after_session_reset
Included Modules
- CacheStoreBehavior
- LocalCacheBehavior
- CacheIncrementDecrementBehavior
- EncodedKeyCacheBehavior
- AutoloadingCacheBehavior
Constants
| MEMCACHE_UP | = | true |
Instance Public methods
setup()
Link
# File activesupport/test/caching_test.rb, line 1020 def setup skip "memcache server is not up" unless MEMCACHE_UP @cache = ActiveSupport::Cache.lookup_store(:mem_cache_store, :expires_in => 60) @peek = ActiveSupport::Cache.lookup_store(:mem_cache_store) @data = @cache.instance_variable_get(:@data) @cache.clear @cache.silence! @cache.logger = ActiveSupport::Logger.new("/dev/null") end
test_can_call_deprecated_escape_key()
Link
test_deserializes_unloaded_class()
Link
# File actionpack/test/dispatch/session/mem_cache_store_test.rb, line 136 def test_deserializes_unloaded_class with_test_route_set do with_autoload_path "session_autoload_test" do get '/set_serialized_session_value' assert_response :success assert cookies['_session_id'] end with_autoload_path "session_autoload_test" do get '/get_session_id' assert_response :success end end rescue Dalli::RingError => ex skip ex.message, ex.backtrace end
test_getting_from_nonexistent_session()
Link
# File actionpack/test/dispatch/session/mem_cache_store_test.rb, line 87 def test_getting_from_nonexistent_session with_test_route_set do get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body assert_nil cookies['_session_id'], "should only create session on write, not read" end rescue Dalli::RingError => ex skip ex.message, ex.backtrace end
test_getting_nil_session_value()
Link
# File actionpack/test/dispatch/session/mem_cache_store_test.rb, line 56 def test_getting_nil_session_value with_test_route_set do get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body end rescue Dalli::RingError => ex skip ex.message, ex.backtrace end
test_getting_session_id()
Link
# File actionpack/test/dispatch/session/mem_cache_store_test.rb, line 121 def test_getting_session_id with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'] session_id = cookies['_session_id'] get '/get_session_id' assert_response :success assert_equal session_id, response.body, "should be able to read session id without accessing the session hash" end rescue Dalli::RingError => ex skip ex.message, ex.backtrace end
test_getting_session_value_after_session_reset()
Link
# File actionpack/test/dispatch/session/mem_cache_store_test.rb, line 66 def test_getting_session_value_after_session_reset with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'] session_cookie = cookies.send(:hash_for)['_session_id'] get '/call_reset_session' assert_response :success assert_not_equal [], headers['Set-Cookie'] cookies << session_cookie # replace our new session_id with our old, pre-reset session_id get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body, "data for this session should have been obliterated from memcached" end rescue Dalli::RingError => ex skip ex.message, ex.backtrace end
test_local_cache_raw_values()
Link
test_local_cache_raw_values_with_marshal()
Link
# File activesupport/test/caching_test.rb, line 1060 def test_local_cache_raw_values_with_marshal cache = ActiveSupport::Cache.lookup_store(:mem_cache_store, :raw => true) cache.clear cache.with_local_cache do cache.write("foo", Marshal.dump([])) assert_equal [], cache.read("foo") end end
test_prevents_session_fixation()
Link
# File actionpack/test/dispatch/session/mem_cache_store_test.rb, line 166 def test_prevents_session_fixation with_test_route_set do get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body session_id = cookies['_session_id'] reset! get '/set_session_value', params: { _session_id: session_id } assert_response :success assert_not_equal session_id, cookies['_session_id'] end rescue Dalli::RingError => ex skip ex.message, ex.backtrace end
test_raw_values()
Link
test_raw_values_with_marshal()
Link
test_read_should_return_a_different_object_id_each_time_it_is_called()
Link
# File activesupport/test/caching_test.rb, line 1069 def test_read_should_return_a_different_object_id_each_time_it_is_called @cache.write('foo', 'bar') value = @cache.read('foo') assert_not_equal value.object_id, @cache.read('foo').object_id value << 'bingo' assert_not_equal value, @cache.read('foo') end
test_setting_and_getting_session_value()
Link
# File actionpack/test/dispatch/session/mem_cache_store_test.rb, line 42 def test_setting_and_getting_session_value with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'] get '/get_session_value' assert_response :success assert_equal 'foo: "bar"', response.body end rescue Dalli::RingError => ex skip ex.message, ex.backtrace end
test_setting_session_value_after_session_reset()
Link
# File actionpack/test/dispatch/session/mem_cache_store_test.rb, line 98 def test_setting_session_value_after_session_reset with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'] session_id = cookies['_session_id'] get '/call_reset_session' assert_response :success assert_not_equal [], headers['Set-Cookie'] get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body get '/get_session_id' assert_response :success assert_not_equal session_id, response.body end rescue Dalli::RingError => ex skip ex.message, ex.backtrace end