From 9b8b91be29020233ec31c2f01d8fdf4ffe373999 Mon Sep 17 00:00:00 2001 From: Andrew Pepler Date: Wed, 8 Jan 2025 11:56:03 +0000 Subject: [PATCH] mock working redis --- spec/controllers/heartbeat_controller_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/controllers/heartbeat_controller_spec.rb b/spec/controllers/heartbeat_controller_spec.rb index b599e63c75..18f07cea79 100644 --- a/spec/controllers/heartbeat_controller_spec.rb +++ b/spec/controllers/heartbeat_controller_spec.rb @@ -17,6 +17,8 @@ end describe "#healthcheck" do + let(:redis) { double("Redis") } # rubocop:disable RSpec/VerifiedDoubles + before do retry_set = instance_double(Sidekiq::RetrySet, size: 0) allow(Sidekiq::RetrySet).to receive(:new).and_return(retry_set) @@ -28,7 +30,6 @@ allow(Sidekiq::ProcessSet).to receive(:new).and_return(process_set) dead_set = instance_double(Sidekiq::DeadSet, size: 1) allow(Sidekiq::DeadSet).to receive(:new).and_return(dead_set) - redis = double("Redis") # rubocop:disable RSpec/VerifiedDoubles allow(Sidekiq).to receive(:redis).and_yield(redis) allow(redis).to receive(:info).and_raise(Errno::ECONNREFUSED) allow(ActiveRecord::Base.connection) @@ -57,7 +58,8 @@ allow(Sidekiq::ProcessSet).to receive(:new).and_return(process_set) dead_set = instance_double(Sidekiq::DeadSet, size: 0) allow(Sidekiq::DeadSet).to receive(:new).and_return(dead_set) - allow(Sidekiq).to receive(:redis_info).and_return({}) + allow(Sidekiq).to receive(:redis).and_yield(redis) + allow(redis).to receive(:info).and_return({}) get :healthcheck end