test/test_helper.rb in identity_cache-0.3.1 vs test/test_helper.rb in identity_cache-0.3.2
- old
+ new
@@ -9,11 +9,11 @@
require 'active_support/cache/memcached_store'
require File.dirname(__FILE__) + '/../lib/identity_cache'
DatabaseConnection.setup
-ActiveSupport::Cache::Store.instrument = true
+ActiveSupport::Cache::Store.instrument = true if ActiveSupport.version < Gem::Version.new("4.2.0")
# This patches AR::MemcacheStore to notify AS::Notifications upon read_multis like the rest of rails does
class ActiveSupport::Cache::MemcachedStore
def read_multi_with_instrumentation(*args, &block)
instrument("read_multi", "MULTI", {:keys => args}) do
@@ -36,10 +36,12 @@
DatabaseConnection.drop_tables
DatabaseConnection.create_tables
IdentityCache.logger = Logger.new(nil)
- IdentityCache.cache_backend = @backend = ActiveSupport::Cache::MemcachedStore.new("localhost:11211", :support_cas => true)
+
+ memcached_host = ENV['MEMCACHED_HOST'] || "127.0.0.1"
+ IdentityCache.cache_backend = @backend = ActiveSupport::Cache::MemcachedStore.new("#{memcached_host}:11211", :support_cas => true)
setup_models
end
def teardown