diff --git a/app/controllers/health/workers_controller.rb b/app/controllers/health/workers_controller.rb index 7edbecada14..a4573c32d7b 100644 --- a/app/controllers/health/workers_controller.rb +++ b/app/controllers/health/workers_controller.rb @@ -1,17 +1,11 @@ module Health class WorkersController < ApplicationController def index - summary = worker_health_checker.summary + summary = WorkerHealthChecker.summary status = summary.all_healthy? ? :ok : :internal_error render json: summary, status: status end - - protected - - def worker_health_checker - @_worker_health_checker ||= WorkerHealthChecker - end end end diff --git a/spec/controllers/health/workers_controller_spec.rb b/spec/controllers/health/workers_controller_spec.rb index 2742b44dd54..d2860076e08 100644 --- a/spec/controllers/health/workers_controller_spec.rb +++ b/spec/controllers/health/workers_controller_spec.rb @@ -3,14 +3,12 @@ RSpec.describe Health::WorkersController do describe '#index' do before do - allow(controller).to receive(:worker_health_checker). - and_return(class_double('WorkerHealthChecker', - summary: WorkerHealthChecker::Summary.new(statuses))) + allow(WorkerHealthChecker).to receive(:summary). + and_return(WorkerHealthChecker::Summary.new(statuses)) end subject(:action) { get :index } - let(:all_healthy) { true } let(:statuses) do [ WorkerHealthChecker::Status.new('voice', 0.minutes.ago, true),