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| spool.each { |item|
if item[:type] == 'direct' if item[:type] == 'direct'
log 'notice', "send spool to (user_id=#{ current_user.id })", client_id 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 else
log 'notice', "send spool", client_id log 'notice', "send spool", client_id
Session.send( client_id, item[:message] ) Session.send( client_id, item[:message]['data'] )
end end
} }
# send spool:sent event to client # send spool:sent event to client
sleep 0.2
log 'notice', "send spool:sent event", client_id log 'notice', "send spool:sent event", client_id
Session.send( client_id, { :event => 'spool:sent' } ) Session.send( client_id, { :event => 'spool:sent' } )
end end

View file

@ -93,10 +93,35 @@ class ChatTest < TestCase
:value => message, :value => message,
:match_result => true, :match_result => true,
}, },
# { {
# :execute => 'wait', :where => :instance1,
# :value => 1, :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 break
end end
end end
elsif action[:execute] == 'navigate'
instance.navigate.to( action[:to] )
else else
assert( false, "(#{test[:name]}) unknow selector for '#{action[:element]}'" ) assert( false, "(#{test[:name]}) unknow selector for '#{action[:element]}'" )
end end
@ -289,6 +291,7 @@ class TestCase < Test::Unit::TestCase
end end
elsif action[:execute] == 'check' elsif action[:execute] == 'check'
elsif action[:execute] == 'close_all_tasks' elsif action[:execute] == 'close_all_tasks'
elsif action[:execute] == 'navigate'
else else
assert( false, "(#{test[:name]}) unknow action '#{action[:execute]}'" ) assert( false, "(#{test[:name]}) unknow action '#{action[:execute]}'" )
end end