aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/stubs
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2016-01-15 17:11:30 -0500
committerJon Moss <me@jonathanmoss.me>2016-01-18 18:59:01 -0500
commitbc413e814bbeafe8774b166bd2447ec84475b402 (patch)
tree584d37f9189eb260362ddef9c0bdb00b7148c005 /actioncable/test/stubs
parent9631c6771061866bd89b4f632a5507c5a54603e4 (diff)
downloadrails-bc413e814bbeafe8774b166bd2447ec84475b402.tar.gz
rails-bc413e814bbeafe8774b166bd2447ec84475b402.tar.bz2
rails-bc413e814bbeafe8774b166bd2447ec84475b402.zip
Tests passing and small refactoring
Diffstat (limited to 'actioncable/test/stubs')
-rw-r--r--actioncable/test/stubs/test_adapter.rb10
-rw-r--r--actioncable/test/stubs/test_connection.rb4
-rw-r--r--actioncable/test/stubs/test_server.rb6
3 files changed, 19 insertions, 1 deletions
diff --git a/actioncable/test/stubs/test_adapter.rb b/actioncable/test/stubs/test_adapter.rb
new file mode 100644
index 0000000000..c18ca5dc9d
--- /dev/null
+++ b/actioncable/test/stubs/test_adapter.rb
@@ -0,0 +1,10 @@
+class SuccessAdapter < ActionCable::StorageAdapter::Base
+ def broadcast(channel, payload)
+ end
+
+ def subscribe(channel, callback, success_callback = nil)
+ end
+
+ def unsubscribe(channel, callback)
+ end
+end
diff --git a/actioncable/test/stubs/test_connection.rb b/actioncable/test/stubs/test_connection.rb
index 384abc5e76..fe87dbcb36 100644
--- a/actioncable/test/stubs/test_connection.rb
+++ b/actioncable/test/stubs/test_connection.rb
@@ -11,6 +11,10 @@ class TestConnection
@transmissions = []
end
+ def adapter
+ SuccessAdapter.new(TestServer.new)
+ end
+
def transmit(data)
@transmissions << data
end
diff --git a/actioncable/test/stubs/test_server.rb b/actioncable/test/stubs/test_server.rb
index f9168f9b78..e1eb9f113a 100644
--- a/actioncable/test/stubs/test_server.rb
+++ b/actioncable/test/stubs/test_server.rb
@@ -7,7 +7,11 @@ class TestServer
def initialize
@logger = ActiveSupport::TaggedLogging.new ActiveSupport::Logger.new(StringIO.new)
- @config = OpenStruct.new(log_tags: [])
+ @config = OpenStruct.new(log_tags: [], storage_adapter: SuccessAdapter)
+ end
+
+ def adapter
+ @config.storage_adapter.new(self)
end
def send_async