Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
dabf4793
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dabf4793
编写于
2月 28, 2016
作者:
D
David Heinemeier Hansson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #23811 from iamvery/string-channel
Ensure actioncable behaves as expected with non-string queues
上级
2280c84f
bbe59375
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
1 deletion
+37
-1
actioncable/CHANGELOG.md
actioncable/CHANGELOG.md
+4
-0
actioncable/lib/action_cable/channel/streams.rb
actioncable/lib/action_cable/channel/streams.rb
+1
-0
actioncable/lib/action_cable/server/broadcasting.rb
actioncable/lib/action_cable/server/broadcasting.rb
+1
-1
actioncable/test/channel/stream_test.rb
actioncable/test/channel/stream_test.rb
+16
-0
actioncable/test/server/broadcasting_test.rb
actioncable/test/server/broadcasting_test.rb
+15
-0
未找到文件。
actioncable/CHANGELOG.md
浏览文件 @
dabf4793
*
Ensure ActionCable behaves correctly for non-string queue names.
*Jay Hayes*
## Rails 5.0.0.beta3 (February 24, 2016) ##
*
Added
`em_redis_connector`
and
`redis_connector`
to
...
...
actioncable/lib/action_cable/channel/streams.rb
浏览文件 @
dabf4793
...
...
@@ -72,6 +72,7 @@ module Streams
# Start streaming from the named <tt>broadcasting</tt> pubsub queue. Optionally, you can pass a <tt>callback</tt> that'll be used
# instead of the default of just transmitting the updates straight to the subscriber.
def
stream_from
(
broadcasting
,
callback
=
nil
)
broadcasting
=
String
(
broadcasting
)
# Don't send the confirmation until pubsub#subscribe is successful
defer_subscription_confirmation!
...
...
actioncable/lib/action_cable/server/broadcasting.rb
浏览文件 @
dabf4793
...
...
@@ -26,7 +26,7 @@ def broadcast(broadcasting, message)
# Returns a broadcaster for a named <tt>broadcasting</tt> that can be reused. Useful when you have an object that
# may need multiple spots to transmit to a specific broadcasting over and over.
def
broadcaster_for
(
broadcasting
)
Broadcaster
.
new
(
self
,
broadcasting
)
Broadcaster
.
new
(
self
,
String
(
broadcasting
)
)
end
private
...
...
actioncable/test/channel/stream_test.rb
浏览文件 @
dabf4793
...
...
@@ -14,7 +14,12 @@ def subscribed
def
send_confirmation
transmit_subscription_confirmation
end
end
class
SymbolChannel
<
ActionCable
::
Channel
::
Base
def
subscribed
stream_from
:channel
end
end
test
"streaming start and stop"
do
...
...
@@ -28,6 +33,17 @@ def send_confirmation
end
end
test
"stream from non-string channel"
do
run_in_eventmachine
do
connection
=
TestConnection
.
new
connection
.
expects
(
:pubsub
).
returns
mock
().
tap
{
|
m
|
m
.
expects
(
:subscribe
).
with
(
"channel"
,
kind_of
(
Proc
),
kind_of
(
Proc
)).
returns
stub_everything
(
:pubsub
)
}
channel
=
SymbolChannel
.
new
connection
,
""
connection
.
expects
(
:pubsub
).
returns
mock
().
tap
{
|
m
|
m
.
expects
(
:unsubscribe
)
}
channel
.
unsubscribe_from_channel
end
end
test
"stream_for"
do
run_in_eventmachine
do
connection
=
TestConnection
.
new
...
...
actioncable/test/server/broadcasting_test.rb
0 → 100644
浏览文件 @
dabf4793
require
"test_helper"
class
BroadcastingTest
<
ActiveSupport
::
TestCase
class
TestServer
include
ActionCable
::
Server
::
Broadcasting
end
test
"fetching a broadcaster converts the broadcasting queue to a string"
do
broadcasting
=
:test_queue
server
=
TestServer
.
new
broadcaster
=
server
.
broadcaster_for
(
broadcasting
)
assert_equal
"test_queue"
,
broadcaster
.
broadcasting
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录