Sha256: e2d9f8e72b73e712810ae0e7a5eeebbe4093a1242245598e45835b0c08411aff
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require 'rspec' require 'mercury/test_utils' require 'mercury/fake' include Mercury::TestUtils # the block must return a Cps def test_with_mercury_cps(sources, queues, **kws, &block) em do seql do let(:m) { Mercury::Monadic.open(**kws) } and_then { delete_sources_and_queues_cps(sources, queues) } and_then { block.call(m) } and_then { delete_sources_and_queues_cps(sources, queues) } and_then { m.close } and_lift { done } end.run end end module MercuryFakeSpec def self.included(base) base.extend(ClassMethods) end module ClassMethods # runs a test once with real mercury and once with Mercury::Fake def itt(name, &block) it(name, &block) context 'without publisher confirms' do before :each do real_open = Mercury.method(:open) allow(Mercury).to receive(:open) do |**kws, &k| real_open.call(**kws.merge(wait_for_publisher_confirms: false), &k) end end it(name, &block) end context 'with Mercury::Fake' do before :each do allow(Mercury).to receive(:open) do |parallelism:1, &k| EM.next_tick { k.call(Mercury::Fake.new(parallelism: parallelism)) } end end it(name, &block) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mercury_amqp-0.3.0 | spec/spec_helper.rb |
mercury_amqp-0.2.0 | spec/spec_helper.rb |