From c5fa9acbeaf6323c3776786184eb2d56f05d551a Mon Sep 17 00:00:00 2001 From: "Yasuko Ohba (nay3)" Date: Thu, 30 Jul 2026 11:11:53 +0900 Subject: [PATCH] =?UTF-8?q?=E8=AA=8D=E8=A8=BC=E3=81=AA=E3=81=97=E3=81=A7?= =?UTF-8?q?=E3=82=A2=E3=82=AF=E3=82=BB=E3=82=B9=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=83=98=E3=83=AB=E3=82=B9=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF?= =?UTF-8?q?=E7=94=A8=E3=81=AE=20/up=20=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 4 ++++ spec/requests/health_check_spec.rb | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 spec/requests/health_check_spec.rb 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