Sha256: 4ec4b698c2002f4deb34e43a58e12d5e29f1539094740a0e456741a005ff6584

Contents?: true

Size: 1.76 KB

Versions: 5

Compression:

Stored size: 1.76 KB

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) # AridCache lib
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))       # test lib

require 'fileutils'
require 'rubygems'
require 'active_record'
require 'active_support'
require 'active_support/test_case'
require 'test/unit' # required by ActiveSupport::TestCase
require 'will_paginate'
require 'ruby-debug'

# Activate Will Paginate 
WillPaginate.enable_activerecord

# Add support for expiring file-cache store.
require 'active_support/cache/file_store_extras'

# Activate AridCache
require 'arid_cache'
AridCache.init_rails

# Setup logging
log = File.expand_path(File.join(File.dirname(__FILE__), 'log', 'test.log'))
RAILS_DEFAULT_LOGGER = ENV["STDOUT"] ? Logger.new(STDOUT) : Logger.new(log)

# Setup the cache. Use the file-store cache because the
# memory-store cache doesn't delete cache keys...I don't know why.
RAILS_CACHE = ActiveSupport::Cache.lookup_store(:file_store, "#{File.dirname(__FILE__)}/tmp/cache")

# Mock Rails
Rails = Class.new do
  cattr_accessor :logger, :cache
  def self.cache
    return RAILS_CACHE
  end
  def self.logger
    return RAILS_DEFAULT_LOGGER
  end
end

# Set loggers for all frameworks
for framework in ([ :active_record, :action_controller, :action_mailer ])
  if Object.const_defined?(framework.to_s.camelize)
    framework.to_s.camelize.constantize.const_get("Base").logger = Rails.logger
  end
end
ActiveSupport::Dependencies.logger = Rails.logger
Rails.cache.logger = Rails.logger

# Include this last otherwise the logger isn't set properly
require 'db/prepare'

ActiveRecord::Base.logger.info("#{"="*25} RUNNING UNIT TESTS #{"="*25}\n\t\t\t#{Time.now.to_s}\n#{"="*70}")

Array.class_eval { alias count size } if RUBY_VERSION < '1.8.7'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arid_cache-0.2.7 test/test_helper.rb
arid_cache-0.2.6 test/test_helper.rb
arid_cache-0.2.5 test/test_helper.rb
arid_cache-0.2.4 test/test_helper.rb
arid_cache-0.2.3 test/test_helper.rb