From cfce1e9537a1e552f0d0185fe7c6a74bb20e3a4f Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Fri, 10 Apr 2026 13:13:16 +0900 Subject: [PATCH 1/3] =?UTF-8?q?/kata=20=E3=83=9A=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=81=AE=E5=86=85=E9=83=A8=E3=83=AA=E3=83=B3=E3=82=AF=E6=AD=BB?= =?UTF-8?q?=E6=B4=BB=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #1814 で `/event` というデッドリンクが修正されたことを受け、 同様の問題の再発を防ぐため Request spec を追加。 - Nokogiri で /kata ページの内部リンクを全件抽出し、 各パスが 400 未満のレスポンスを返すことを確認 - `/events` のハードコードを `events_path` ヘルパーに改善 --- app/views/docs/kata.html.erb | 12 ++++++------ spec/requests/docs_spec.rb | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/app/views/docs/kata.html.erb b/app/views/docs/kata.html.erb index 8d2b8f62..fab536ca 100644 --- a/app/views/docs/kata.html.erb +++ b/app/views/docs/kata.html.erb @@ -57,7 +57,7 @@

各 Dojo は、チャンピオンやメンターと呼ばれる協力者によって自主的に運営されています。プログラマーやデザイナーだけでなく、学生や教員、アーティストやフリーランス、起業家や投資家などの方々が分野横断的に協力しあって、それぞれの Dojo が継続的に運営されています。もちろん、参加者自身や参加者の親が運営に協力する事例も多いです。

<%= lazy_image_tag('/kata/coderdojo-zero.webp', alt: 'CoderDojo を支える方々の写真', style: 'margin-top: 30px; margin-bottom: 40px;', min: true) %> - +

初めての人へ @@ -87,7 +87,7 @@

CoderDojo の雰囲気は掴めたでしょうか? もっと詳しく知るには実際に参加してみるのが近道です。<%= link_to '日本の道場一覧', root_path(anchor: 'dojos') %>や<%= link_to '近日開催の道場', events_path %>、もしくは<%= link_to '地図情報(DojoMap)', dojomap_url %> から最寄りの道場を探してみましょう!

- <%= link_to '/events', class: 'btn-blue' do %> + <%= link_to events_path, class: 'btn-blue' do %> 📆 近日開催から探す <% end %> @@ -250,7 +250,7 @@ - +

📜 Web記事・プレスリリース @@ -674,7 +674,7 @@

- +

🏅 コンテスト @@ -895,7 +895,7 @@

具体的なイメージが掴めたら、準備・申請の手続きを進めていきましょう!

- +

☯️ Dojo の設立・初回開催までの流れ(制作: CoderDojo Kodaira @@ -1328,7 +1328,7 @@

<%= link_to 'ボランティアのための子ども安全保護チェックリスト', 'https://raspberrypi.my.salesforce.com/sfc/p/#4J000000GeqW/a/8d000000PGbW/TH92cMY9bA.gvpWJx0xXME.cFddNiDAEZ0rG4ciel00' %>(英語)

by <%= link_to 'Raspberry Pi & CoderDojo Foundation', raspi_url %>

- +
  • Start a CoderDojo - What is CoderDojo?(英語)

    by <%= link_to 'Raspberry Pi & CoderDojo Foundation', raspi_url %>

    diff --git a/spec/requests/docs_spec.rb b/spec/requests/docs_spec.rb index 9ae7ddc0..8ae151c5 100644 --- a/spec/requests/docs_spec.rb +++ b/spec/requests/docs_spec.rb @@ -23,6 +23,25 @@ expect(response.status).to eq 302 end + # /kata page internal links should not be dead links + context 'kata page - internal links check' do + it 'has no dead internal links' do + get '/kata' + doc = Nokogiri::HTML(response.body) + links = doc.css('a[href]').map { |a| a['href'] } + .select { |href| href.start_with?('/') && !href.start_with?('/#') } + .map { |href| href.split('#').first } + .uniq + + dead_links = links.reject do |path| + get path + response.status < 400 + end + + expect(dead_links).to be_empty, "Dead links found: #{dead_links.join(', ')}" + end + end + # /signup page has Google Form to be rendered. context 'signup page - Google Form rendering (Critical)' do before { get doc_path('signup') } From 5596761e67331fb898d605f0bb5ce889acba156d Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Fri, 10 Apr 2026 13:14:12 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=82=B9=E3=83=9A=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E3=82=92=E6=8F=83=E3=81=88=E3=81=A6=E6=95=B4=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/requests/docs_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/requests/docs_spec.rb b/spec/requests/docs_spec.rb index 8ae151c5..4cc84d1b 100644 --- a/spec/requests/docs_spec.rb +++ b/spec/requests/docs_spec.rb @@ -30,7 +30,7 @@ doc = Nokogiri::HTML(response.body) links = doc.css('a[href]').map { |a| a['href'] } .select { |href| href.start_with?('/') && !href.start_with?('/#') } - .map { |href| href.split('#').first } + .map { |href| href.split('#').first } .uniq dead_links = links.reject do |path| From 170b4c153e3e5c505f7ad834aa777aa29c2b164a Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Fri, 10 Apr 2026 13:21:41 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E7=B5=90?= =?UTF-8?q?=E6=9E=9C=E3=81=AB=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=83=AA=E3=83=B3=E3=82=AF=E4=BB=B6=E6=95=B0=E3=82=92?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/requests/docs_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/requests/docs_spec.rb b/spec/requests/docs_spec.rb index 4cc84d1b..0d68f7ac 100644 --- a/spec/requests/docs_spec.rb +++ b/spec/requests/docs_spec.rb @@ -38,6 +38,7 @@ response.status < 400 end + puts "Checked #{links.count} internal links" expect(dead_links).to be_empty, "Dead links found: #{dead_links.join(', ')}" end end