Fixed spool support for ajax fallback.

This commit is contained in:
Martin Edenhofer 2013-06-17 07:38:17 +02:00
parent fb18f7ee9d
commit c52ab26d5f
3 changed files with 35 additions and 6 deletions

View file

@ -37,14 +37,15 @@ class LongPollingController < ApplicationController
spool.each { |item|
if item[:type] == 'direct'
log 'notice', "send spool to (user_id=#{ current_user.id })", client_id
Session.send( client_id, item[:message] )
Session.send( client_id, item[:message]['data'] )
else
log 'notice', "send spool", client_id
Session.send( client_id, item[:message] )
Session.send( client_id, item[:message]['data'] )
end
}
# send spool:sent event to client
sleep 0.2
log 'notice', "send spool:sent event", client_id
Session.send( client_id, { :event => 'spool:sent' } )
end

View file

@ -93,10 +93,35 @@ class ChatTest < TestCase
:value => message,
:match_result => true,
},
# {
# :execute => 'wait',
# :value => 1,
# },
{
:where => :instance1,
:execute => 'navigate',
:to => browser_url,
},
{
:execute => 'wait',
:value => 8,
},
{
:where => :instance1,
:execute => 'click',
:css => '#chat_toogle',
},
{
:execute => 'wait',
:value => 1,
},
{
:where => :instance1,
:execute => 'match',
:css => '#chat_log_container',
:value => message,
:match_result => true,
},
{
:execute => 'wait',
:value => 8,
},
],
},
]

View file

@ -198,6 +198,8 @@ class TestCase < Test::Unit::TestCase
break
end
end
elsif action[:execute] == 'navigate'
instance.navigate.to( action[:to] )
else
assert( false, "(#{test[:name]}) unknow selector for '#{action[:element]}'" )
end
@ -289,6 +291,7 @@ class TestCase < Test::Unit::TestCase
end
elsif action[:execute] == 'check'
elsif action[:execute] == 'close_all_tasks'
elsif action[:execute] == 'navigate'
else
assert( false, "(#{test[:name]}) unknow action '#{action[:execute]}'" )
end