Sha256: 8391f119e709ecb38c555d6f990ad7ae4d524a97d2ccde845d91f1572b474f26
Contents?: true
Size: 1.64 KB
Versions: 4
Compression:
Stored size: 1.64 KB
Contents
require 'spec_helper' describe 'Concurrency' do let(:freddy) { Freddy.build(logger, config) } it 'supports nested calls in #respond_to' do freddy.respond_to 'Concurrency1' do |payload, msg_handler| begin result = freddy.deliver_with_response 'Concurrency2', msg: 'noop' msg_handler.success(result) rescue Freddy::InvalidRequestError => e msg_handler.error(e.response) end end freddy.respond_to 'Concurrency2' do |payload, msg_handler| begin result = freddy.deliver_with_response 'Concurrency3', msg: 'noop' msg_handler.success(result) rescue Freddy::InvalidRequestError => e msg_handler.error(e.response) end end freddy.respond_to 'Concurrency3' do |payload, msg_handler| msg_handler.success({from: 'Concurrency3'}) end result = begin freddy.deliver_with_response 'Concurrency1', msg: 'noop' rescue Freddy::InvalidRequestError => e e.response end expect(result).to eq(from: 'Concurrency3') end it 'supports nested calls in #tap_into' do received1 = false received2 = false freddy.tap_into 'concurrency.*.queue1' do result = freddy.deliver_with_response 'TapConcurrency', msg: 'noop' expect(result).to eq(from: 'TapConcurrency') received1 = true end freddy.respond_to 'TapConcurrency' do |payload, msg_handler| msg_handler.success({from: 'TapConcurrency'}) received2 = true end freddy.deliver 'concurrency.q.queue1', msg: 'noop' wait_for { received1 && received2 } expect(received1).to be(true) expect(received2).to be(true) end end
Version data entries
4 entries across 4 versions & 1 rubygems