spec/models/concerns/subscribable_spec.rb in reactor-0.17.0 vs spec/models/concerns/subscribable_spec.rb in reactor-0.18.0
- old
+ new
@@ -21,10 +21,15 @@
on_event :a_high_frequency_event, deprecated: true do |event|
raise 'hell'
end
+ on_event :event_with_ui_bound,
+ sidekiq_options: { queue: 'highest_priority', retry: false } do |event|
+ speedily_execute!
+ end
+
def self.ring_bell(event)
"ring ring! #{event}"
end
end
@@ -144,9 +149,21 @@
it 'doesnt enqueue subscriber worker when true' do
# so subscriber can be safely deleted in next deploy
expect {
Reactor::Event.publish(:a_high_frequency_event)
}.to_not raise_exception
+ end
+ end
+
+ describe 'passing sidekiq_options through to Sidekiq' do
+ it 'passes options to Sidekiq API' do
+ expect(Reactor::StaticSubscribers::Auction::EventWithUiBoundHandler.get_sidekiq_options).
+ to eql({ 'queue' => 'highest_priority', 'retry' => false })
+ end
+
+ it 'keeps default options when none supplied' do
+ expect(Reactor::StaticSubscribers::Auction::WildcardHandler.get_sidekiq_options).
+ to eql({ 'queue' => 'default', 'retry' => true })
end
end
describe '#perform' do
around(:each) do |example|