File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- return unless defined? ( ::Sidekiq ::Cron ::Job )
3+ # Try requiring sidekiq-cron to ensure it's loaded before the integration.
4+ # If sidekiq-cron is not available, do nothing.
5+ begin
6+ require "sidekiq-cron"
7+ rescue LoadError
8+ return
9+ end
410
511module Sentry
612 module Sidekiq
Original file line number Diff line number Diff line change 1010 before do
1111 schedule_file = 'spec/fixtures/schedule.yml'
1212 schedule = Sidekiq ::Cron ::Support . load_yaml ( ERB . new ( IO . read ( schedule_file ) ) . result )
13- Sidekiq ::Cron ::Job . load_from_hash! ( schedule , source : 'schedule' )
13+ # sidekiq-cron 2.0+ accepts second argument to `load_from_hash!` with options,
14+ # such as {source: 'schedule'}, but sidekiq-cron 1.9.1 (last version to support Ruby 2.6) does not.
15+ # Since we're not using the source option in our code anyway, it's safe to not pass the 2nd arg.
16+ Sidekiq ::Cron ::Job . load_from_hash! ( schedule )
1417 end
1518
1619 it 'patches class' do
You can’t perform that action at this time.
0 commit comments