lib/reactor/testing/matchers.rb in reactor-0.8.3 vs lib/reactor/testing/matchers.rb in reactor-0.9.0

- old
+ new

@@ -2,31 +2,29 @@ supports_block_expectations match do |block| defaults = {:actor => anything} - allow(Reactor::Event).to receive(:publish).with(name, a_hash_including(defaults.merge(data))) + allow(Reactor::Event).to receive(:publish) block.call - expect(Reactor::Event).to have_received(:publish).with(name, a_hash_including(defaults.merge(data))) + 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} - names.each do |name| - allow(Reactor::Event).to receive(:publish).with(name, a_hash_including(defaults)) - end + 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)) + 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|