spec/event_spec.rb in reactor-0.10.1 vs spec/event_spec.rb in reactor-0.11.0

- old
+ new

@@ -7,10 +7,19 @@ class Cat < Pet end end class ArbitraryModel < ActiveRecord::Base + + on_event :barfed, handler_name: :bad do + raise 'UNEXPECTED!' + end + + on_event :barfed do + 'that was gross' + end + end class OtherWorker include Sidekiq::Worker end @@ -53,21 +62,10 @@ expect_any_instance_of(Reactor::Subscriber).to receive(:fire).with(hash_including(actor_id: model.id.to_s)) Reactor::Event.perform(event_name, actor_id: model.id.to_s, actor_type: model.class.to_s) end describe 'when subscriber throws exception', :sidekiq do - let(:mock) { double(:thing, some_method: 3) } let(:barfing_event) { Reactor::Event.perform('barfed', somethin: 'up', actor_id: model.id.to_s, actor_type: model.class.to_s) } - - before do - Reactor::SUBSCRIBERS['barfed'] ||= [] - Reactor::SUBSCRIBERS['barfed'] << Reactor::Subscribable::StaticSubscriberFactory.create('barfed') do |event| - raise 'UNEXPECTED!' - end - Reactor::SUBSCRIBERS['barfed'] << Reactor::Subscribable::StaticSubscriberFactory.create('barfed') do |event| - mock.some_method - end - end it 'doesnt matter because it runs in a separate worker process' do expect { barfing_event }.to_not raise_exception end end