aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/client_test.rb
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-02-05 22:48:48 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2016-02-14 17:46:48 +0100
commit661298176c72eefc6d0f42b58210119e76962364 (patch)
tree521b31e85b607dff781a3ad40ae43bdf52022f8b /actioncable/test/client_test.rb
parentf611e59cb16677156c231aa6328f7e7d47da2a28 (diff)
downloadrails-661298176c72eefc6d0f42b58210119e76962364.tar.gz
rails-661298176c72eefc6d0f42b58210119e76962364.tar.bz2
rails-661298176c72eefc6d0f42b58210119e76962364.zip
Inject Rails' channel paths in engine.
We were explicitly referencing Rails.root in ActionCable::Server::Configuration.initialize, thereby coupling ourselves to Rails. Instead add `app/channels` to Rails' app paths and assign the existent files to `channel_paths`. Users can still append to those load paths with `<<` and `push` in `config/application.rb`. This means we can remove the custom `Dir` lookup in `channel_paths` and the Rails and root definitions in the tests.
Diffstat (limited to 'actioncable/test/client_test.rb')
-rw-r--r--actioncable/test/client_test.rb10
1 files changed, 1 insertions, 9 deletions
diff --git a/actioncable/test/client_test.rb b/actioncable/test/client_test.rb
index 4ade9832e0..f2b090cc52 100644
--- a/actioncable/test/client_test.rb
+++ b/actioncable/test/client_test.rb
@@ -16,12 +16,8 @@ class ClientTest < ActionCable::TestCase
::Object.const_set(:ApplicationCable, Module.new)
::ApplicationCable.const_set(:Connection, Class.new(ActionCable::Connection::Base))
- ::Object.const_set(:Rails, Module.new)
- ::Rails.singleton_class.send(:define_method, :root) { Pathname.new(__dir__) }
-
ActionCable.instance_variable_set(:@server, nil)
server = ActionCable.server
- server.config = ActionCable::Server::Configuration.new
inner_logger = Logger.new(StringIO.new).tap { |l| l.level = Logger::UNKNOWN }
server.config.logger = ActionCable::Connection::TaggedLoggerProxy.new(inner_logger, tags: [])
@@ -29,7 +25,7 @@ class ClientTest < ActionCable::TestCase
# and now the "real" setup for our test:
server.config.disable_request_forgery_protection = true
- server.config.channel_load_paths = [File.expand_path('client', __dir__)]
+ server.config.channel_paths = [ File.expand_path('client/echo_channel.rb', __dir__) ]
Thread.new { EventMachine.run } unless EventMachine.reactor_running?
Thread.pass until EventMachine.reactor_running?
@@ -45,10 +41,6 @@ class ClientTest < ActionCable::TestCase
::Object.send(:remove_const, :ApplicationCable)
rescue NameError
end
- begin
- ::Object.send(:remove_const, :Rails)
- rescue NameError
- end
end
def with_puma_server(rack_app = ActionCable.server, port = 3099)