aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable
diff options
context:
space:
mode:
authorJeremy Daer <jeremydaer@gmail.com>2017-11-13 00:55:06 -0700
committerJeremy Daer <jeremydaer@gmail.com>2017-11-13 01:34:59 -0700
commit8f2490b57f488ed60fc6e0a201ccd5e66811ab51 (patch)
tree3579a9b495b0bcee8dc9c7d5f5468f1c8fe811b0 /actioncable
parenta45f234b028fd4dda5338e5073a3bf2b8bf2c6fd (diff)
downloadrails-8f2490b57f488ed60fc6e0a201ccd5e66811ab51.tar.gz
rails-8f2490b57f488ed60fc6e0a201ccd5e66811ab51.tar.bz2
rails-8f2490b57f488ed60fc6e0a201ccd5e66811ab51.zip
Action Cable: run Redis tests against a default config without a password
Simplify our dev testing and CI story since we're also testing against Redis for the Active Support cache store. Directly test whether db, host, password, etc are passed through as config instead of spinning up a Redis server with a password set on it.
Diffstat (limited to 'actioncable')
-rw-r--r--actioncable/test/subscription_adapter/redis_test.rb23
1 files changed, 21 insertions, 2 deletions
diff --git a/actioncable/test/subscription_adapter/redis_test.rb b/actioncable/test/subscription_adapter/redis_test.rb
index 69120d5753..63823d6ef0 100644
--- a/actioncable/test/subscription_adapter/redis_test.rb
+++ b/actioncable/test/subscription_adapter/redis_test.rb
@@ -4,12 +4,15 @@ 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
include CommonSubscriptionAdapterTest
include ChannelPrefixTest
def cable_config
- { adapter: "redis", driver: "ruby", url: "redis://:password@127.0.0.1:6379/12" }
+ { adapter: "redis", driver: "ruby" }
end
end
@@ -23,6 +26,22 @@ 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, password: "password")
+ alt_cable_config.merge(host: "127.0.0.1", port: 6379, db: 12)
+ 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 }
+
+ 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