1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Passing in a Hash instance as non-kwargs parameters has to be curly braced

This commit is contained in:
Akira Matsuda 2019-09-07 03:21:45 +09:00
parent 9a15149dab
commit 8cc1bf9e2b
4 changed files with 7 additions and 7 deletions

View file

@ -64,7 +64,7 @@ class ActionCable::Channel::BaseTest < ActionCable::TestCase
end end
def get_latest def get_latest
transmit data: "latest" transmit({ data: "latest" })
end end
def receive def receive

View file

@ -136,7 +136,7 @@ class PerformTestChannel < ActionCable::Channel::Base
end end
def ping def ping
transmit type: "pong" transmit({ type: "pong" })
end end
end end
@ -173,7 +173,7 @@ class BroadcastsTestChannel < ActionCable::Channel::Base
def broadcast(data) def broadcast(data)
ActionCable.server.broadcast( ActionCable.server.broadcast(
"broadcast_#{params[:id]}", "broadcast_#{params[:id]}",
text: data["message"], user_id: user_id { text: data["message"], user_id: user_id }
) )
end end

View file

@ -40,16 +40,16 @@ class ClientTest < ActionCable::TestCase
end end
def ding(data) def ding(data)
transmit(dong: data["message"]) transmit({ dong: data["message"] })
end end
def delay(data) def delay(data)
sleep 1 sleep 1
transmit(dong: data["message"]) transmit({ dong: data["message"] })
end end
def bulk(data) def bulk(data)
ActionCable.server.broadcast "global", wide: data["message"] ActionCable.server.broadcast "global", { wide: data["message"] }
end end
end end

View file

@ -88,7 +88,7 @@ class TransmittedDataTest < ActionCable::TestCase
def test_assert_broadcast_on_with_hash def test_assert_broadcast_on_with_hash
assert_nothing_raised do assert_nothing_raised do
assert_broadcast_on("test", text: "hello") do assert_broadcast_on("test", text: "hello") do
ActionCable.server.broadcast "test", text: "hello" ActionCable.server.broadcast "test", { text: "hello" }
end end
end end
end end