Sha256: 3f3c96db5ebe89011fb7686aa15786b68779e2f69709627e139dab3a3f12fd6c

Contents?: true

Size: 1.84 KB

Versions: 13

Compression:

Stored size: 1.84 KB

Contents

require File.dirname(__FILE__) + '/../abstract_unit'

MemCache = Struct.new(:MemCache, :address) unless Object.const_defined?(:MemCache)

class FragmentCacheStoreSettingTest < Test::Unit::TestCase
  def teardown
    ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::MemoryStore.new
  end
  
  def test_file_fragment_cache_store
    ActionController::Base.fragment_cache_store = :file_store, "/path/to/cache/directory"
    assert_kind_of(
      ActionController::Caching::Fragments::FileStore,
      ActionController::Base.fragment_cache_store
    )
    assert_equal "/path/to/cache/directory", ActionController::Base.fragment_cache_store.cache_path
  end
  
  def test_drb_fragment_cache_store
    ActionController::Base.fragment_cache_store = :drb_store, "druby://localhost:9192"
    assert_kind_of(
      ActionController::Caching::Fragments::DRbStore,
      ActionController::Base.fragment_cache_store
    )
    assert_equal "druby://localhost:9192", ActionController::Base.fragment_cache_store.address
  end

  if defined? CGI::Session::MemCacheStore
    def test_mem_cache_fragment_cache_store
      ActionController::Base.fragment_cache_store = :mem_cache_store, "localhost"
      assert_kind_of(
        ActionController::Caching::Fragments::MemCacheStore,
        ActionController::Base.fragment_cache_store
      )
      assert_equal %w(localhost), ActionController::Base.fragment_cache_store.addresses
    end
  end

  def test_object_assigned_fragment_cache_store
    ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::FileStore.new("/path/to/cache/directory")
    assert_kind_of(
      ActionController::Caching::Fragments::FileStore,
      ActionController::Base.fragment_cache_store
    )
    assert_equal "/path/to/cache/directory", ActionController::Base.fragment_cache_store.cache_path
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
actionpack-2.0.2 test/controller/fragment_store_setting_test.rb
actionpack-2.0.1 test/controller/fragment_store_setting_test.rb
actionpack-2.0.5 test/controller/fragment_store_setting_test.rb
actionpack-2.0.0 test/controller/fragment_store_setting_test.rb
actionpack-2.0.4 test/controller/fragment_store_setting_test.rb
radiant-0.6.5.1 vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb
radiant-0.6.5 vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb
radiant-0.6.6 vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb
radiant-0.6.7 vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb
radiant-0.6.9 vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb
radiant-0.6.8 vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb
spree-0.0.9 vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb
spree-0.2.0 vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb