Skip to content

Commit

Permalink
Fix a race in ActionCable stream tests
Browse files Browse the repository at this point in the history
These tests double-stub connection.pubsub, so we need to ensure the
first call's completed before we set up for the second.
  • Loading branch information
matthewd committed Mar 22, 2017
1 parent 911f44f commit 62a8e83
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions actioncable/test/channel/stream_test.rb
Expand Up @@ -55,6 +55,8 @@ class StreamTest < ActionCable::TestCase
channel = ChatChannel.new connection, "{id: 1}", id: 1
channel.subscribe_to_channel

wait_for_async

connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) }
channel.unsubscribe_from_channel
end
Expand All @@ -67,6 +69,8 @@ class StreamTest < ActionCable::TestCase
channel = SymbolChannel.new connection, ""
channel.subscribe_to_channel

wait_for_async

connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) }
channel.unsubscribe_from_channel
end
Expand Down

0 comments on commit 62a8e83

Please sign in to comment.