diff --git a/config/routes.rb b/config/routes.rb index 911ad077..725d79ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,6 +4,10 @@ # The priority is based upon order of creation: # first created -> highest priority. + # 死活監視用。Rails::HealthController は ApplicationController を経由しないため + # BASIC 認証やログインなしでアクセスできる + get 'up' => 'rails/health#show', as: :rails_health_check + # settings namespace :settings do controller :accounts do diff --git a/spec/requests/health_check_spec.rb b/spec/requests/health_check_spec.rb new file mode 100644 index 00000000..7b097f34 --- /dev/null +++ b/spec/requests/health_check_spec.rb @@ -0,0 +1,10 @@ +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') + +describe 'ヘルスチェック', type: :request do + describe 'GET /up' do + it '200 を返す' do + get '/up' + expect(response).to have_http_status(:ok) + end + end +end