Fix jobs specs

This commit is contained in:
Eugene Burmakin 2025-09-19 21:48:43 +02:00
parent e169cc7074
commit a1e83991fa

View file

@ -58,7 +58,7 @@ RSpec.describe BulkVisitsSuggestingJob, type: :job do
allow(User).to receive(:active).and_return(active_users_mock)
allow(active_users_mock).to receive(:active).and_return(active_users_mock)
allow(active_users_mock).to receive(:where).with(id: []).and_return(active_users_mock)
# allow(active_users_mock).to receive(:find_each).and_yield(user_with_points)
allow(active_users_mock).to receive(:find_each).and_yield(user_with_points)
chunks.each do |chunk|
expect(VisitSuggestingJob).to receive(:perform_later).with(
@ -100,11 +100,11 @@ RSpec.describe BulkVisitsSuggestingJob, type: :job do
.and_return(time_chunks_instance)
allow(time_chunks_instance).to receive(:call).and_return(custom_chunks)
# active_users_mock = double('ActiveRecord::Relation')
# allow(User).to receive(:active).and_return(active_users_mock)
# allow(active_users_mock).to receive(:active).and_return(active_users_mock)
# allow(active_users_mock).to receive(:where).with(id: []).and_return(active_users_mock)
# allow(active_users_mock).to receive(:find_each).and_yield(user_with_points)
active_users_mock = double('ActiveRecord::Relation')
allow(User).to receive(:active).and_return(active_users_mock)
allow(active_users_mock).to receive(:active).and_return(active_users_mock)
allow(active_users_mock).to receive(:where).with(id: []).and_return(active_users_mock)
allow(active_users_mock).to receive(:find_each).and_yield(user_with_points)
expect(VisitSuggestingJob).to receive(:perform_later).with(
user_id: user_with_points.id,