Skip to content

Commit

Permalink
fix morph stream action specs
Browse files Browse the repository at this point in the history
  • Loading branch information
omarluq committed Feb 15, 2024
1 parent 41d8b84 commit 266fa01
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions test/streams/broadcastable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,18 @@ class Turbo::BroadcastableTest < ActionCable::Channel::TestCase
@message.broadcast_render_to @profile
end
end

test "broadcasting morph to stream now" do
assert_broadcast_on "stream", turbo_stream_action_tag("morph", target: "message_1", template: render(@message)) do
@message.broadcast_morph_to "stream", target: "message_1"
end
end

test "broadcasting morph now" do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("morph", target: "message_1", template: render(@message)) do
@message.broadcast_morph target: "message_1"
end
end
end

class Turbo::BroadcastableArticleTest < ActionCable::Channel::TestCase
Expand Down Expand Up @@ -518,34 +530,6 @@ class Turbo::SuppressingBroadcastsTest < ActionCable::Channel::TestCase
end
end

test "broadcasting morph to stream now" do
assert_broadcast_on "stream", turbo_stream_action_tag("morph", target: "message_1", template: render(@message)) do
@message.broadcast_morph_to "stream", target: "message_1"
end
end

test "broadcasting morph to stream later" do
assert_broadcast_on "stream", turbo_stream_action_tag("morph", target: "message_1", template: render(@message)) do
perform_enqueued_jobs do
@message.broadcast_morph_later_to "stream", target: "message_1"
end
end
end

test "broadcasting morph now" do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("morph", target: "message_1", template: render(@message)) do
@message.broadcast_morph target: "message_1"
end
end

test "broadcasting morph later" do
assert_broadcast_on @message.to_gid_param, turbo_stream_action_tag("morph", target: "message_1", template: render(@message)) do
perform_enqueued_jobs do
@message.broadcast_morph_later target: "message_1"
end
end
end

test "suppressing broadcasting morph to stream now" do
assert_no_broadcasts_when_suppressing do
@message.broadcast_morph_to "stream"
Expand Down

0 comments on commit 266fa01

Please sign in to comment.