# Common matchers for controller specs RSpec::Matchers.define :listen_to do |use_case| match do |listener| expect(use_case).to receive(:subscribe).with(listener, prefix: :on).once end end RSpec::Matchers.define :run_after_subscriptions do match do |use_case| expect(use_case).to receive(:subscribe).ordered expect(use_case).to receive(:run).once.ordered end end