lib/reactor/testing/matchers.rb in reactor-0.16.1 vs lib/reactor/testing/matchers.rb in reactor-0.17.0

- old
+ new

@@ -1,5 +1,12 @@ +# +# DRY up strict event & data assertions. +# +# Example: +# +# expect { some_thing }.to publish_event(:some_event, actor: this_user, target: this_object) +# RSpec::Matchers.define :publish_event do |name, data = {}| supports_block_expectations match do |block| defaults = {:actor => anything} @@ -10,9 +17,17 @@ expect(Reactor::Event).to have_received(:publish).with(name, a_hash_including(defaults.merge(data))).at_least(:once) end end + +# +# DRY up multi-event assertions. Unfortunately can't test key-values with this at the moment. +# +# Example: +# +# expect { some_thing }.to publish_events(:some_event, :another_event) +# RSpec::Matchers.define :publish_events do |*names| supports_block_expectations match do |block| defaults = {:actor => anything}