Sha256: 5616c9728dc5774cfc54860b90b7c58fba3723c64c77aff42d9d74b5936f170b
Contents?: true
Size: 1.38 KB
Versions: 6
Compression:
Stored size: 1.38 KB
Contents
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require 'minitest/autorun' module TestHelpers def jruby? RUBY_ENGINE == "jruby" end def initialize_redis_kit Rails.application.initializers.select do |initializer| initializer.name =~ /redis-kit/ end.each do |initializer| initializer.run( Rails.application ) end $redis.client.connect if $redis.client.respond_to?( :connect ) end def get_socket( redis ) case connection = redis.client.connection when Redis::Connection::Ruby connection.instance_variable_get( "@sock" ) when Redis::Connection::Hiredis connection.instance_variable_get("@connection").sock else raise "#{connection} isn't a known connection type." end end def initialize_resque Resque.redis = $redis Resque.redis.client.connect if Resque.redis.client.respond_to?( :connect ) Resque.after_fork = nil RedisKit::Resque.setup end def resque_worker worker = Resque::Worker.new( :test ) worker.term_child = "1" worker end end class ActiveSupport::TestCase include TestHelpers class << self include TestHelpers end end class TestResqueJob @queue = :test class << self include TestHelpers def perform $redis.ping $redis.set("socket", get_socket($redis).to_s) end end end
Version data entries
6 entries across 6 versions & 1 rubygems