Sha256: ebdb0618d0d24453a0bc01cb2a9be3fd3039b0f15871010a3df72247b2bc29ff
Contents?: true
Size: 910 Bytes
Versions: 7
Compression:
Stored size: 910 Bytes
Contents
RSpec::Matchers.define :publish_event do |name, data = {}| supports_block_expectations match do |block| defaults = {:actor => anything} allow(Reactor::Event).to receive(:publish) block.call expect(Reactor::Event).to have_received(:publish).with(name, a_hash_including(defaults.merge(data))).at_least(:once) end end RSpec::Matchers.define :publish_events do |*names| supports_block_expectations match do |block| defaults = {:actor => anything} allow(Reactor::Event).to receive(:publish) block.call names.each do |name| expect(Reactor::Event).to have_received(:publish).with(name, a_hash_including(defaults)).at_least(:once) end end end RSpec::Matchers.define :subscribe_to do |name, data = {}, &expectations| supports_block_expectations match do expectations.call if expectations.present? Reactor::Event.publish(name, data) end end
Version data entries
7 entries across 7 versions & 1 rubygems