1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actioncable/test/subscription_adapter/redis_test.rb

45 lines
1.1 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
require "test_helper"
require_relative "common"
require_relative "channel_prefix"
2016-01-24 05:43:40 -05:00
require "action_cable/subscription_adapter/redis"
2016-01-24 05:43:40 -05:00
class RedisAdapterTest < ActionCable::TestCase
include CommonSubscriptionAdapterTest
include ChannelPrefixTest
2016-01-24 05:43:40 -05:00
def cable_config
{ adapter: "redis", driver: "ruby" }
end
end
class RedisAdapterTest::Hiredis < RedisAdapterTest
def cable_config
super.merge(driver: "hiredis")
2016-01-24 05:43:40 -05:00
end
end
class RedisAdapterTest::AlternateConfiguration < RedisAdapterTest
def cable_config
alt_cable_config = super.dup
alt_cable_config.delete(:url)
alt_cable_config.merge(host: "127.0.0.1", port: 6379, db: 12)
end
end
class RedisAdapterTest::Connector < ActionCable::TestCase
test "slices url, host, port, db, and password from config" do
config = { url: 1, host: 2, port: 3, db: 4, password: 5 }
assert_called_with ::Redis, :new, [ config ] do
connect config.merge(other: "unrelated", stuff: "here")
end
end
def connect(config)
ActionCable::SubscriptionAdapter::Redis.redis_connector.call(config)
end
end