test/test_helper.rb in extface-0.5.3 vs test/test_helper.rb in extface-0.5.4a
- old
+ new
@@ -19,10 +19,19 @@
load "#{Rails.root}/db/schema.rb"
fixtures :all
def simulate_device_pull(job)
- Extface.redis_block{ |r| sleep 1; r.publish(job.id, "OK") } #simulate send to device
+ result = nil
+ Extface.redis_block do |r|
+ list, data = r.blpop(job.id, timeout: 1)
+ while data
+ result = data
+ r.publish(job.id, "OK")
+ list, data = r.blpop(job.id, timeout: 1)
+ end
+ end #simulate send to device
+ result
end
end
module Extface
class ActionController::TestCase
setup do