class EventedRedisAdapterTest

Public Instance Methods

cable_config() click to toggle source
# File actioncable/test/subscription_adapter/evented_redis_test.rb, line 58
def cable_config
  { adapter: "evented_redis", url: "redis://:password@127.0.0.1:6379/12" }
end
setup() click to toggle source
Calls superclass method CommonSubscriptionAdapterTest#setup
# File actioncable/test/subscription_adapter/evented_redis_test.rb, line 11
def setup
  assert_deprecated do
    super
  end

  # em-hiredis is warning-rich
  @previous_verbose, $VERBOSE = $VERBOSE, nil
end
teardown() click to toggle source
Calls superclass method CommonSubscriptionAdapterTest#teardown
# File actioncable/test/subscription_adapter/evented_redis_test.rb, line 20
def teardown
  super

  # Ensure EM is shut down before we re-enable warnings
  EventMachine.reactor_thread.tap do |thread|
    EventMachine.stop
    thread.join
  end

  $VERBOSE = @previous_verbose
end
test_slow_eventmachine() click to toggle source
# File actioncable/test/subscription_adapter/evented_redis_test.rb, line 32
def test_slow_eventmachine
  require "eventmachine"
  require "thread"

  lock = Mutex.new

  EventMachine.singleton_class.class_eval do
    alias_method :delayed_initialize_event_machine, :initialize_event_machine
    define_method(:initialize_event_machine) do
      lock.synchronize do
        sleep 0.5
        delayed_initialize_event_machine
      end
    end
  end

  test_basic_broadcast
ensure
  lock.synchronize do
    EventMachine.singleton_class.class_eval do
      alias_method :initialize_event_machine, :delayed_initialize_event_machine
      remove_method :delayed_initialize_event_machine
    end
  end
end