diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2016-03-31 07:08:49 -0700 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2016-03-31 07:08:49 -0700 |
commit | 9a83ef38912063db127a3918b0f155d5d3acfe3b (patch) | |
tree | e6225bc33dcc1dcefdfefca4537bde07bc8df94a /actioncable/test/stubs/test_server.rb | |
parent | 903f447e436a7c909c3afc552f27bbbc1b4770c8 (diff) | |
parent | b168eb5819fa5fea940c9865d5c9a3ec5ba2a7ec (diff) | |
download | rails-9a83ef38912063db127a3918b0f155d5d3acfe3b.tar.gz rails-9a83ef38912063db127a3918b0f155d5d3acfe3b.tar.bz2 rails-9a83ef38912063db127a3918b0f155d5d3acfe3b.zip |
Merge pull request #24233 from jeremy/cable/encoding
Cable message encoding
Diffstat (limited to 'actioncable/test/stubs/test_server.rb')
-rw-r--r-- | actioncable/test/stubs/test_server.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/actioncable/test/stubs/test_server.rb b/actioncable/test/stubs/test_server.rb index 9e860825f3..b86f422a13 100644 --- a/actioncable/test/stubs/test_server.rb +++ b/actioncable/test/stubs/test_server.rb @@ -2,22 +2,26 @@ require 'ostruct' class TestServer include ActionCable::Server::Connections + include ActionCable::Server::Broadcasting - attr_reader :logger, :config + attr_reader :logger, :config, :mutex - def initialize + def initialize(subscription_adapter: SuccessAdapter) @logger = ActiveSupport::TaggedLogging.new ActiveSupport::Logger.new(StringIO.new) - @config = OpenStruct.new(log_tags: [], subscription_adapter: SuccessAdapter) + + @config = OpenStruct.new(log_tags: [], subscription_adapter: subscription_adapter) @config.use_faye = ENV['FAYE'].present? @config.client_socket_class = if @config.use_faye ActionCable::Connection::FayeClientSocket else ActionCable::Connection::ClientSocket end + + @mutex = Monitor.new end def pubsub - @config.subscription_adapter.new(self) + @pubsub ||= @config.subscription_adapter.new(self) end def event_loop |