diff options
Diffstat (limited to 'actioncable/test/subscription_adapter/redis_test.rb')
-rw-r--r-- | actioncable/test/subscription_adapter/redis_test.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/actioncable/test/subscription_adapter/redis_test.rb b/actioncable/test/subscription_adapter/redis_test.rb index 63823d6ef0..ac2d8ef724 100644 --- a/actioncable/test/subscription_adapter/redis_test.rb +++ b/actioncable/test/subscription_adapter/redis_test.rb @@ -4,7 +4,6 @@ require "test_helper" require_relative "common" require_relative "channel_prefix" -require "active_support/testing/method_call_assertions" require "action_cable/subscription_adapter/redis" class RedisAdapterTest < ActionCable::TestCase @@ -30,17 +29,23 @@ class RedisAdapterTest::AlternateConfiguration < RedisAdapterTest end end -class RedisAdapterTest::Connector < ActiveSupport::TestCase - include ActiveSupport::Testing::MethodCallAssertions - - test "slices url, host, port, db, and password from config" do - config = { url: 1, host: 2, port: 3, db: 4, password: 5 } +class RedisAdapterTest::Connector < ActionCable::TestCase + test "slices url, host, port, db, password and id from config" do + config = { url: 1, host: 2, port: 3, db: 4, password: 5, id: "Some custom ID" } assert_called_with ::Redis, :new, [ config ] do connect config.merge(other: "unrelated", stuff: "here") end end + test "adds default id if it is not specified" do + config = { url: 1, host: 2, port: 3, db: 4, password: 5, id: "ActionCable-PID-#{$$}" } + + assert_called_with ::Redis, :new, [ config ] do + connect config.except(:id) + end + end + def connect(config) ActionCable::SubscriptionAdapter::Redis.redis_connector.call(config) end |