Skip to content

Commit

Permalink
[WEBDEV-624] Create HealthCheckController
Browse files Browse the repository at this point in the history
- Replaces static health-check which enables us to have access logging
- Update config/routes.rb
  • Loading branch information
cazwazacz committed Aug 9, 2018
1 parent 52b281d commit cd2d608
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/controllers/health_check_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class HealthCheckController < ApplicationController
def index
render plain: 'OK'
end
end
4 changes: 4 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

### Health check ###
# /health-check
get '/health-check', to: 'health_check#index'
end
1 change: 0 additions & 1 deletion public/health-check

This file was deleted.

18 changes: 18 additions & 0 deletions spec/controllers/health_check_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
require 'rails_helper'

RSpec.describe HealthCheckController do
describe 'GET index' do
before(:each) do
get :index
end

it 'should have a response with http status ok (200)' do
expect(response).to have_http_status(:ok)
end

it 'should return the text OK' do
expect(response.body).to eq 'OK'
end
end
end

0 comments on commit cd2d608

Please sign in to comment.