Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Changes

* [#1011](https://github.com/toptal/chewy/pull/1011): Replace deprecated `Sidekiq::Testing` API with new `Sidekiq 8.1+` testing API and silence Sidekiq logger during spec runs. ([@mattmenefee][], [@mjankowski][])
* [#1014](https://github.com/toptal/chewy/pull/1014): Improve contributing documentation with development setup instructions, PR workflow, and grammar fixes. ([@mattmenefee][])

## 8.0.1 (2026-03-12)
Expand Down Expand Up @@ -879,12 +880,14 @@
[@MarkMurphy]: https://github.com/MarkMurphy
[@marshall]: https://github.com/marshall
[@matchbookmac]: https://github.com/matchbookmac
[@mattmenefee]: https://github.com/mattmenefee
[@matthee]: https://github.com/matthee
[@mattmenefee]: https://github.com/mattmenefee
[@mattzollinhofer]: https://github.com/mattzollinhofer
[@menglewis]: https://github.com/menglewis
[@mikeyhogarth]: https://github.com/mikeyhogarth
[@milk1000cc]: https://github.com/milk1000cc
[@mjankowski]: https://github.com/mjankowski
[@mkcode]: https://github.com/mkcode
[@mpeychich]: https://github.com/mpeychich
[@mrbrdo]: https://github.com/mrbrdo
Expand Down
2 changes: 0 additions & 2 deletions spec/chewy/strategy/delayed_sidekiq/scheduler_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'spec_helper'

if defined?(Sidekiq)
require 'sidekiq/testing'

describe Chewy::Strategy::DelayedSidekiq::Scheduler do
before do
stub_model(:city)
Expand Down
1 change: 0 additions & 1 deletion spec/chewy/strategy/delayed_sidekiq/worker_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'spec_helper'

if defined?(Sidekiq)
require 'sidekiq/testing'
require 'redis'

describe Chewy::Strategy::DelayedSidekiq::Worker do
Expand Down
5 changes: 2 additions & 3 deletions spec/chewy/strategy/delayed_sidekiq_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'spec_helper'

if defined?(Sidekiq)
require 'sidekiq/testing'
require 'redis'

describe Chewy::Strategy::DelayedSidekiq do
Expand Down Expand Up @@ -73,7 +72,7 @@

expect($stdout).not_to receive(:puts)

Sidekiq::Testing.inline! do
Sidekiq.testing!(:inline) do
expect { [city, other_city].map(&:save!) }
.to update_index(CitiesIndex, strategy: :delayed_sidekiq)
.and_reindex(city, other_city).only
Expand Down Expand Up @@ -114,7 +113,7 @@ def expected_at_time

expect($stdout).to receive(:puts).with('hello') # check that reindex_wrapper works

Sidekiq::Testing.inline! do
Sidekiq.testing!(:inline) do
expect { [city, other_city].map(&:save!) }
.to update_index(CitiesIndex, strategy: :delayed_sidekiq)
.and_reindex(city, other_city).only
Expand Down
12 changes: 5 additions & 7 deletions spec/chewy/strategy/lazy_sidekiq_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'spec_helper'

if defined?(Sidekiq)
require 'sidekiq/testing'

describe Chewy::Strategy::LazySidekiq do
around do |example|
sidekiq_settings = Chewy.settings[:sidekiq]
Expand Down Expand Up @@ -39,7 +37,7 @@
))
.and_call_original
.once
Sidekiq::Testing.inline! do
Sidekiq.testing!(:inline) do
expect { [city, other_city].map(&:save!) }
.to update_index(CitiesIndex, strategy: :lazy_sidekiq)
.and_reindex(city, other_city).only
Expand All @@ -60,7 +58,7 @@
))
.and_call_original
.once
Sidekiq::Testing.inline! do
Sidekiq.testing!(:inline) do
expect { [city, other_city].map(&:destroy) }.to update_index(CitiesIndex, strategy: :sidekiq)
end
end
Expand All @@ -71,7 +69,7 @@
expect(other_city).to receive(:run_chewy_callbacks).and_call_original

expect do
Sidekiq::Testing.inline! do
Sidekiq.testing!(:inline) do
Chewy::Strategy::LazySidekiq::IndicesUpdateWorker.new.perform({'City' => [city.id, other_city.id]})
end
end.to update_index(CitiesIndex).and_reindex(city, other_city).only
Expand All @@ -88,7 +86,7 @@
expect(other_city).to receive(:run_chewy_callbacks).and_call_original

expect do
Sidekiq::Testing.inline! do
Sidekiq.testing!(:inline) do
Chewy::Strategy::LazySidekiq::IndicesUpdateWorker.new.perform({'City' => [city.id, other_city.id]})
end
end.to update_index(CitiesIndex).and_reindex(city, other_city).only.no_refresh
Expand All @@ -97,7 +95,7 @@
end

context 'integration' do
around { |example| Sidekiq::Testing.inline! { example.run } }
around { |example| Sidekiq.testing!(:inline) { example.run } }

let(:update_condition) { true }

Expand Down
4 changes: 1 addition & 3 deletions spec/chewy/strategy/sidekiq_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'spec_helper'

if defined?(Sidekiq)
require 'sidekiq/testing'

describe Chewy::Strategy::Sidekiq do
around do |example|
sidekiq_settings = Chewy.settings[:sidekiq]
Expand Down Expand Up @@ -31,7 +29,7 @@

specify do
expect(Sidekiq::Client).to receive(:push).with(hash_including('queue' => 'low')).and_call_original
Sidekiq::Testing.inline! do
Sidekiq.testing!(:inline) do
expect { [city, other_city].map(&:save!) }
.to update_index(CitiesIndex, strategy: :sidekiq)
.and_reindex(city, other_city).only
Expand Down
5 changes: 5 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

Kaminari::Hooks.init if defined?(Kaminari::Hooks)

if defined?(Sidekiq)
Sidekiq.testing!(:fake)
Sidekiq.default_configuration.logger = nil
end

require 'support/fail_helpers'
require 'support/class_helpers'

Expand Down