Skip to content

Commit

Permalink
mock working redis
Browse files Browse the repository at this point in the history
  • Loading branch information
vertism committed Jan 8, 2025
1 parent 2a87085 commit 9b8b91b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spec/controllers/heartbeat_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9b8b91b

Please sign in to comment.