diff options
author | Bryan Helmkamp <bryan@brynary.com> | 2009-05-19 10:24:26 -0400 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-05-19 10:54:56 -0700 |
commit | e2ed1a1ca4f2dbfb9eb2c31fd1ddd45562afef25 (patch) | |
tree | 95c0380f42913615362fc9468b0ea6bca38a8b7d /activesupport/test | |
parent | 6dc3a6a954b742ac7160593f94962b9b93a2ce25 (diff) | |
download | rails-e2ed1a1ca4f2dbfb9eb2c31fd1ddd45562afef25.tar.gz rails-e2ed1a1ca4f2dbfb9eb2c31fd1ddd45562afef25.tar.bz2 rails-e2ed1a1ca4f2dbfb9eb2c31fd1ddd45562afef25.zip |
Allow MemCacheStore to be initialized with a MemCache object instead of addresses and options
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/caching_test.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index b845796fe5..ad19dcfd09 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -15,22 +15,28 @@ class CacheStoreSettingTest < ActiveSupport::TestCase end def test_mem_cache_fragment_cache_store + MemCache.expects(:new).with(%w[localhost], {}) store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost" assert_kind_of(ActiveSupport::Cache::MemCacheStore, store) - assert_equal %w(localhost), store.addresses + end + + def test_mem_cache_fragment_cache_store_with_given_mem_cache + mem_cache = MemCache.new + MemCache.expects(:new).never + store = ActiveSupport::Cache.lookup_store :mem_cache_store, mem_cache + assert_kind_of(ActiveSupport::Cache::MemCacheStore, store) end def test_mem_cache_fragment_cache_store_with_multiple_servers + MemCache.expects(:new).with(%w[localhost 192.168.1.1], {}) store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost", '192.168.1.1' assert_kind_of(ActiveSupport::Cache::MemCacheStore, store) - assert_equal %w(localhost 192.168.1.1), store.addresses end def test_mem_cache_fragment_cache_store_with_options + MemCache.expects(:new).with(%w[localhost 192.168.1.1], { :namespace => "foo" }) store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost", '192.168.1.1', :namespace => 'foo' assert_kind_of(ActiveSupport::Cache::MemCacheStore, store) - assert_equal %w(localhost 192.168.1.1), store.addresses - assert_equal 'foo', store.instance_variable_get('@data').instance_variable_get('@namespace') end def test_object_assigned_fragment_cache_store |