test/test_helper.rb in identity_cache-0.2.2 vs test/test_helper.rb in identity_cache-0.2.3
- old
+ new
@@ -8,13 +8,10 @@
require 'memcached_store'
require 'active_support/cache/memcached_store'
require File.dirname(__FILE__) + '/../lib/identity_cache'
-$memcached_port = 11211
-$mysql_port = 3306
-
DatabaseConnection.setup
ActiveSupport::Cache::Store.instrument = true
# This patches AR::MemcacheStore to notify AS::Notifications upon read_multis like the rest of rails does
class ActiveSupport::Cache::MemcachedStore
@@ -27,25 +24,30 @@
alias_method_chain :read_multi, :instrumentation
end
class IdentityCache::TestCase < MiniTest::Unit::TestCase
include ActiveRecordObjects
- attr_reader :backend, :fetcher
+ attr_reader :backend
def setup
DatabaseConnection.drop_tables
DatabaseConnection.create_tables
IdentityCache.logger = Logger.new(nil)
- IdentityCache.cache_backend = @backend = ActiveSupport::Cache::MemcachedStore.new("localhost:#{$memcached_port}", :support_cas => true)
- @fetcher = IdentityCache.cache.cache_fetcher
+ IdentityCache.cache_backend = @backend = ActiveSupport::Cache::MemcachedStore.new("localhost:11211", :support_cas => true)
setup_models
end
def teardown
IdentityCache.cache.clear
teardown_models
+ end
+
+ private
+
+ def fetcher
+ IdentityCache.cache.cache_fetcher
end
def assert_nothing_raised
yield
end