1 require File.dirname(__FILE__) + '/../abstract_unit'
3 MemCache = Struct.new(:MemCache, :address) unless Object.const_defined?(:MemCache)
5 class FragmentCacheStoreSettingTest < Test::Unit::TestCase
7 ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::MemoryStore.new
10 def test_file_fragment_cache_store
11 ActionController::Base.fragment_cache_store = :file_store, "/path/to/cache/directory"
13 ActionController::Caching::Fragments::FileStore,
14 ActionController::Base.fragment_cache_store
16 assert_equal "/path/to/cache/directory", ActionController::Base.fragment_cache_store.cache_path
19 def test_drb_fragment_cache_store
20 ActionController::Base.fragment_cache_store = :drb_store, "druby://localhost:9192"
22 ActionController::Caching::Fragments::DRbStore,
23 ActionController::Base.fragment_cache_store
25 assert_equal "druby://localhost:9192", ActionController::Base.fragment_cache_store.address
28 if defined? CGI::Session::MemCacheStore
29 def test_mem_cache_fragment_cache_store
30 ActionController::Base.fragment_cache_store = :mem_cache_store, "localhost"
32 ActionController::Caching::Fragments::MemCacheStore,
33 ActionController::Base.fragment_cache_store
35 assert_equal %w(localhost), ActionController::Base.fragment_cache_store.addresses
39 def test_object_assigned_fragment_cache_store
40 ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::FileStore.new("/path/to/cache/directory")
42 ActionController::Caching::Fragments::FileStore,
43 ActionController::Base.fragment_cache_store
45 assert_equal "/path/to/cache/directory", ActionController::Base.fragment_cache_store.cache_path