Permalink
Browse files

got em_stream stuff working

  • Loading branch information...
markburns authored and stevegraham committed Apr 7, 2012
1 parent 1736e66 commit e60cbd077863e27c305c3c3275ca990589afd07e
Showing with 10 additions and 17 deletions.
  1. +10 −17 spec/integration/integration_spec.rb
@@ -60,13 +60,11 @@ def em_stream
websocket = new_websocket
stream(websocket, messages) do |message|
messages << JSON.parse(message)
yield websocket, messages
end
end
return websocket, messages
return messages
end
def em_thread
@@ -87,23 +85,18 @@ def stream websocket, messages
describe 'regular channels:' do
it 'pushes messages to interested websocket connections' do
messages = []
em_thread do
websocket = new_websocket
stream(websocket, messages) do |message|
if messages.length < 3
Pusher['MY_CHANNEL'].trigger_async 'an_event', { some: 'data' }
else
EM.stop
end
end
messages = em_stream do |websocket, messages|
websocket.callback do
websocket.send({ event: 'pusher:subscribe', data: { channel: 'MY_CHANNEL'} }.to_json)
end if messages.one?
if messages.length < 3
Pusher['MY_CHANNEL'].trigger_async 'an_event', { some: 'data' }
else
EM.stop
end
end
end
# Slanger should send an object denoting connection was succesfully established
messages.first['event'].should == 'pusher:connection_established'

0 comments on commit e60cbd0

Please sign in to comment.