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
8 changes: 1 addition & 7 deletions app/controllers/health/workers_controller.rb
Original file line number Diff line number Diff line change
@@ -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
6 changes: 2 additions & 4 deletions spec/controllers/health/workers_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down