Permalink
Browse files

continuing DRYing up tests

  • Loading branch information...
markburns authored and stevegraham committed Apr 6, 2012
1 parent f73d3f1 commit f0f2ab1afdfcdf023b6603970047261178616283
Showing with 7 additions and 3 deletions.
  1. +7 −3 spec/integration/integration_spec.rb
@@ -62,6 +62,11 @@ def stream websocket, messages
end
end
def em_stream
messages = []
yield websocket, messages
end
describe 'regular channels:' do
it 'pushes messages to interested websocket connections' do
messages = []
@@ -101,9 +106,9 @@ def stream websocket, messages
client1.send({ event: 'pusher:subscribe', data: { channel: 'MY_CHANNEL'} }.to_json)
end
client1.stream do |message|
stream(client1, client1_messages) do |message|
# if this is the first message to client 1 set up another connection from the same client
if client1_messages.empty?
if client1_messages.one?
client2 = new_websocket
client2.callback do
@@ -119,7 +124,6 @@ def stream websocket, messages
end
end
end
client1_messages << message
end
end

0 comments on commit f0f2ab1

Please sign in to comment.