aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2016-01-16 10:33:50 -0500
committerJon Moss <me@jonathanmoss.me>2016-01-18 19:37:25 -0500
commitae31da20cd250154c951b67d5625fc71ac27e2f1 (patch)
tree8f9bf6275f9e52c3b8a8b674d0bfd2a941f5bdf9 /actioncable/test
parent980e01eb100b38e39791f7f930a038ecaf7c02da (diff)
downloadrails-ae31da20cd250154c951b67d5625fc71ac27e2f1.tar.gz
rails-ae31da20cd250154c951b67d5625fc71ac27e2f1.tar.bz2
rails-ae31da20cd250154c951b67d5625fc71ac27e2f1.zip
Fix code review comments
- adapter -> pubsub (re)rename internally - Change variable names to match method names - Add EventMachine `~> 1.0` as a runtime dependency of ActionCable - Refactor dependency loading for adapters
Diffstat (limited to 'actioncable/test')
-rw-r--r--actioncable/test/channel/stream_test.rb6
-rw-r--r--actioncable/test/connection/identifier_test.rb8
-rw-r--r--actioncable/test/stubs/test_connection.rb2
-rw-r--r--actioncable/test/stubs/test_server.rb2
4 files changed, 9 insertions, 9 deletions
diff --git a/actioncable/test/channel/stream_test.rb b/actioncable/test/channel/stream_test.rb
index 8424310ca2..3fa2b291b7 100644
--- a/actioncable/test/channel/stream_test.rb
+++ b/actioncable/test/channel/stream_test.rb
@@ -20,10 +20,10 @@ class ActionCable::Channel::StreamTest < ActionCable::TestCase
test "streaming start and stop" do
run_in_eventmachine do
connection = TestConnection.new
- connection.expects(:adapter).returns mock().tap { |m| m.expects(:subscribe).with("test_room_1", kind_of(Proc), kind_of(Proc)).returns stub_everything(:adapter) }
+ connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("test_room_1", kind_of(Proc), kind_of(Proc)).returns stub_everything(:pubsub) }
channel = ChatChannel.new connection, "{id: 1}", { id: 1 }
- connection.expects(:adapter).returns mock().tap { |m| m.expects(:unsubscribe) }
+ connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) }
channel.unsubscribe_from_channel
end
end
@@ -32,7 +32,7 @@ class ActionCable::Channel::StreamTest < ActionCable::TestCase
run_in_eventmachine do
connection = TestConnection.new
EM.next_tick do
- connection.expects(:adapter).returns mock().tap { |m| m.expects(:subscribe).with("action_cable:channel:stream_test:chat:Room#1-Campfire", kind_of(Proc), kind_of(Proc)).returns stub_everything(:adapter) }
+ connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("action_cable:channel:stream_test:chat:Room#1-Campfire", kind_of(Proc), kind_of(Proc)).returns stub_everything(:pubsub) }
end
channel = ChatChannel.new connection, ""
diff --git a/actioncable/test/connection/identifier_test.rb b/actioncable/test/connection/identifier_test.rb
index bdc793e56d..a110dfdee0 100644
--- a/actioncable/test/connection/identifier_test.rb
+++ b/actioncable/test/connection/identifier_test.rb
@@ -23,12 +23,12 @@ class ActionCable::Connection::IdentifierTest < ActionCable::TestCase
test "should subscribe to internal channel on open and unsubscribe on close" do
run_in_eventmachine do
- adapter = mock('adapter')
- adapter.expects(:subscribe).with('action_cable/User#lifo', kind_of(Proc))
- adapter.expects(:unsubscribe).with('action_cable/User#lifo', kind_of(Proc))
+ pubsub = mock('pubsub_adapter')
+ pubsub.expects(:subscribe).with('action_cable/User#lifo', kind_of(Proc))
+ pubsub.expects(:unsubscribe).with('action_cable/User#lifo', kind_of(Proc))
server = TestServer.new
- server.stubs(:adapter).returns(adapter)
+ server.stubs(:pubsub).returns(pubsub)
open_connection server: server
close_connection
diff --git a/actioncable/test/stubs/test_connection.rb b/actioncable/test/stubs/test_connection.rb
index fe87dbcb36..da98201900 100644
--- a/actioncable/test/stubs/test_connection.rb
+++ b/actioncable/test/stubs/test_connection.rb
@@ -11,7 +11,7 @@ class TestConnection
@transmissions = []
end
- def adapter
+ def pubsub
SuccessAdapter.new(TestServer.new)
end
diff --git a/actioncable/test/stubs/test_server.rb b/actioncable/test/stubs/test_server.rb
index 067266ed57..6e6541a952 100644
--- a/actioncable/test/stubs/test_server.rb
+++ b/actioncable/test/stubs/test_server.rb
@@ -10,7 +10,7 @@ class TestServer
@config = OpenStruct.new(log_tags: [], subscription_adapter: SuccessAdapter)
end
- def adapter
+ def pubsub
@config.subscription_adapter.new(self)
end