Skip to content

Conversation

@tyrrell-IH
Copy link
Contributor

@tyrrell-IH tyrrell-IH commented Nov 13, 2025

Issue

概要

定期イベントがブックマークできるよう、Bookmarkボタンを追加しました。

変更確認方法

  1. feature/add-bookmark-button-to-regular-eventsをローカルに取り込む
git fetch origin feature/add-bookmark-button-to-regular-events
git checkout feature/add-bookmark-button-to-regular-events
  1. ローカルでサーバーを立ち上げる
foreman start -f Procfile.dev
  1. 修正箇所の確認方法
  • 任意のユーザーでログインする。
  • /regular_eventsへ移動、任意の定期イベントのページを開き、Bookmarkボタンを押しブックマーク登録する。
  • ブックマークした定期イベントが以下のページにそれぞれ表示され、かつリンクをクリックすると該当の定期イベントページに移動することを確認する。
  • ブックマークした定期イベントページに戻り、Bookmark中ボタンを押しブックマークを解除する。
  • ブックマークを解除した定期イベントの表示が以下のページからそれぞれ消えていることを確認する。

Screenshot

変更前

_development__開発MTG___FBC

変更後

_development__開発MTG___FBC _development__開発MTG___FBC _development__ブックマーク一覧___FBC _development__ダッシュボード___FBC

ラベルの改行について

2025/12/27追記
以下の内容についてはf389c49にて改行の対応済みです

ブックマークリンクのラベルについて

  定期
イベント
_development__ブックマーク一覧___FBC

のように、「定期」の文字の後に改行が入っているのが望ましいですが、現在の実装では

定期イベ
  ント
_development__ダッシュボード___FBC

のように表示されています。

本来であれば適切な位置で改行を挟むことが望ましいと思います。

しかし、各ラベル要素を構築しているjsxファイル(以下2件)

  • /current_user/bookmarksBookmarks.jsx
  • /(ダッシュボードのブックマーク欄)BookmarksInDashboard.jsx

について

にて削除予定です。

2025/11/19の開発ミーティング夜の部にて駒形さん、町田さんに了承を得た上で

  • 本PRでは改行の対応をしない
  • #9181#9205がmainにマージされるのを待って改行の対応をする、という趣旨のIssueを別途作成する。

という流れで処理を進めることにしました。


その他

#9104
上記PRを参考にして、本PRを作成しています。

Summary by CodeRabbit

  • 新機能
    • 通常イベントページに「ブックマーク」操作を追加しました(ページ上からイベントをブックマーク/解除可能)。
    • ブックマーク一覧で通常イベントのラベルを2行表示(「定期」「イベント」)するよう改善しました。
  • テスト
    • ブックマークの追加・削除と一覧への反映を検証するシステムテストを追加しました。
    • ラベル表示を検証するビュー helper の単体テストを追加しました。
  • データ
    • テスト用のブックマークデータを追加しました。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 13, 2025

📝 Walkthrough

Walkthrough

正規イベントのページヘッダーに id="bookmark-button" を持つ新しいブックマークボタンを追加し、ラベル表示の特例化(RegularEvent)、関連ヘルパーとテスト(システムテスト・ヘルパーテスト)、およびブックマークリストの描画変更を導入しました。

Changes

Cohort / File(s) Summary
ブックマーク UI ボタン
app/views/regular_events/_regular_event.html.slim
ページヘッダーに id="bookmark-button" のボタンを追加(data-bookmarkable-id / data-bookmarkable-type、クラス a-bookmark-button a-button is-sm is-block is-inactive is-mutedaria-pressed="false"aria-busy="true"、初期無効表示)。
ラベルヘルパー & 表示差し替え
app/helpers/label_helper.rb, app/javascript/components/BookmarksInDashboard.jsx, app/views/current_user/bookmarks/_list.html.slim
RegularEvent 用に表示ラベルを特例化する bookmarkable_label ヘルパーを追加し、ダッシュボードとブックマークリストでそのヘルパーを用いるように変更。RegularEvent は「定期
イベント」を表示。
テスト(システム・ヘルパー)
test/system/bookmark/regular_events_test.rb, test/helpers/label_helper_test.rb
ブックマークの追加/削除とブックマークリストへの反映を検証するシステムテストを追加。bookmarkable_label の出力を検証するヘルパーテストを追加。
フィクスチャ追加
test/fixtures/bookmarks.yml
RegularEvent を参照する新しいブックマーク用フィクスチャ bookmark33 を追加。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • komagata

Poem

🐰 ぴょんと押すは小さなボタン、
ヘッダーに灯る「Bookmark」の章、
リストへ渡る道を確かめて、
テストが見守る跳ねる一歩、
ぴょん、またブックマークしようね ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed タイトルは変更内容を正確に反映しており、定期イベントにブックマークボタンを追加するというPRの主要な変更を簡潔に表現しています。
Description check ✅ Passed プルリクエストの説明は必須セクションをほぼ完全に満たしています。Issue番号、概要、変更確認方法、スクリーンショット(変更前後)が全て記載されています。
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-bookmark-button-to-regular-events

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tyrrell-IH tyrrell-IH force-pushed the feature/add-bookmark-button-to-regular-events branch from 0068292 to f00dbb5 Compare November 14, 2025 01:25
@tyrrell-IH tyrrell-IH marked this pull request as ready for review November 14, 2025 02:32
@tyrrell-IH tyrrell-IH self-assigned this Nov 14, 2025
@tyrrell-IH
Copy link
Contributor Author

tyrrell-IH commented Nov 14, 2025

@machida
定期イベントの詳細ページにブックマークボタンを実装しました。

一応スタイルの確認をしていただいても大丈夫でしょうか?
image

またラベル内の文字が
_development__ブックマーク一覧___FBC

定期イベ
 ント

のようになっているのですが、

 定期
イベント

のようにしたいです。
その点も調整していただきたいのですが可能でしょうか?

@machida
Copy link
Member

machida commented Nov 14, 2025

@tyrrell-IH

定期
br
イベント

このように br タグを入れる対応でお願いしますー🙏

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
app/javascript/components/BookmarksInDashboard.jsx (1)

177-189: コードの重複が存在します。

この関数は Bookmarks.jsx の244-256行目と同一です。Bookmarks.jsx のレビューコメントで提案した共通ユーティリティへの抽出を適用してください。

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f00dbb5 and ca227e6.

📒 Files selected for processing (2)
  • app/javascript/components/Bookmarks.jsx (2 hunks)
  • app/javascript/components/BookmarksInDashboard.jsx (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
app/javascript/components/Bookmarks.jsx (1)
app/javascript/components/BookmarksInDashboard.jsx (1)
  • renderBookmarkLabel (177-189)
app/javascript/components/BookmarksInDashboard.jsx (1)
app/javascript/components/Bookmarks.jsx (1)
  • renderBookmarkLabel (244-256)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (2)
app/javascript/components/Bookmarks.jsx (1)

184-186: ヘルパー関数の使用は適切です。

renderBookmarkLabel ヘルパーの使用により、ラベル表示ロジックが適切に分離されています。

app/javascript/components/BookmarksInDashboard.jsx (1)

122-124: ヘルパー関数の使用は適切です。

renderBookmarkLabel ヘルパーの使用により、ラベル表示ロジックが適切に分離されています。

@tyrrell-IH tyrrell-IH force-pushed the feature/add-bookmark-button-to-regular-events branch from ca227e6 to 79393ab Compare November 17, 2025 00:39
@tyrrell-IH
Copy link
Contributor Author

@smallmonkeykey
こちらレビューお願いできませんでしょうか?

@smallmonkeykey
Copy link
Contributor

@tyrrell-IH
承知しました!1週間ほどお時間いただければと思います!

@tyrrell-IH
Copy link
Contributor Author

@smallmonkeykey
すいません、ちょっと修正したい箇所があるので一旦レビューを待っていただけませんでしょうか?
修正終わり次第またご連絡いたします

@smallmonkeykey
Copy link
Contributor

@tyrrell-IH
承知しました!ご連絡ありがとうございます!

@tyrrell-IH tyrrell-IH force-pushed the feature/add-bookmark-button-to-regular-events branch from 79393ab to 9cbc3c3 Compare November 21, 2025 03:18
@tyrrell-IH
Copy link
Contributor Author

tyrrell-IH commented Nov 21, 2025

@smallmonkeykey
すいません、修正終わりましたのでレビューしていただいて大丈夫です🙏
私の都合で修正を加えたので、レビュー期間は今日から1 週間で大丈夫ですし、それ以降でも大丈夫です

@regular_event = regular_events(:regular_event1)
end

test 'shows regular event link on list when clicking bookmark button' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

質問です!既存のブックマーク関連のテストと違って、RegularEventテストでは 1つのテストで一連の動作をシナリオ的にまとめている構成になっていますが、こちらにした理由はありますか??

Copy link
Contributor Author

@tyrrell-IH tyrrell-IH Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一連の動作をシナリオ的にまとめているわけではないつもりでした〜

以下test/system/bookmark/products_test.rbと比較して意図を説明します

前提

ブックマークボタンを今回実装したわけではないので、ブックマークボタンに関する動作はテストしていないという前提です。

ブックマーク機能は日報にブックマーク機能を実装 by alto-I · Pull Request #2789 · fjordllc/bootcampで日報に初めて導入され、その後ボタンの実装がBookmarkButton.jsxの非React化 by jun-kondo · Pull Request #9104 · fjordllc/bootcampにてバニラJSで実装されており、いずれにおいてもブックマークボタンの動作

  • is-active is-inactiveの切り替えがうまくいくか
  • ボタンをクリックした際にリクエストが飛ぶかどうか

等はtest/system/bookmarks_test.rbtest/integration/api/bookmarks_test.rbで保証されていると考えました。

今回のテストの趣旨

上記の前提を踏まえた上で、今回のPRは「定期イベントにブックマークボタンを追加する」なので、テストの内容を

  • テスト1

    • ブックマークされていない定期イベントにおいて
    • 「ブックマーク」ボタンを押すと
    • ボタンの名称が「ブックマーク中」に変更され
    • current_user/bookmarksにブックマークした定期イベントのリンクが表示される
  • テスト2

    • ブックマークされている定期イベントにおいて
    • 「ブックマークボタン中」ボタンを押すと
    • ボタンの名称が「ブックマーク」に変更され
    • current_user/bookmarksからブックマークした定期イベントのリンクが消える

の2点で良いかなと判断しました。

test/system/bookmark/products_test.rbとの比較

test/system/bookmark/products_test.rbは以下の通りです

class Bookmark::ProductTest < ApplicationSystemTestCase
  setup do
    @product = products(:product1)
  end

  test 'show product bookmark on lists' do
    visit_with_auth '/current_user/bookmarks', 'kimura'
    assert_text @product.title
  end

  test 'show active button when bookmarked product' do
    visit_with_auth "/products/#{@product.id}", 'kimura'
    wait_for_javascript_components
    assert_selector '#bookmark-button.is-active'
    assert_no_selector '#bookmark-button.is-inactive'
  end

  test 'show inactive button when not bookmarked product' do
    visit_with_auth "/products/#{@product.id}", 'komagata'
    wait_for_javascript_components
    assert_selector '#bookmark-button.is-inactive'
    assert_no_selector '#bookmark-button.is-active'
  end

  test 'bookmark product' do
    visit_with_auth "/products/#{@product.id}", 'komagata'
    wait_for_javascript_components
    find('#bookmark-button').click
    wait_for_javascript_components
    assert_selector '#bookmark-button.is-active'
    assert_no_selector '#bookmark-button.is-inactive'

    visit '/current_user/bookmarks'
    assert_text @product.title
  end

  test 'unbookmark product' do
    visit_with_auth "/products/#{@product.id}", 'kimura'
    wait_for_javascript_components
    find('#bookmark-button').click
    wait_for_javascript_components
    assert_selector '#bookmark-button.is-inactive'
    assert_no_selector '#bookmark-button.is-active'

    visit '/current_user/bookmarks'
    assert_no_text @product.title
  end
end

上記のうち

  • show product bookmark on listsについてはブックマークボタンを押した後に/current_user/bookmarksに表示されていることが確認できれば良いと考えたので、個別のテストは不要と考えました。
  • show active button when bookmarked productshow inactive button when not bookmarked productについて、is-activeis-inactiveの切り替えについてはtest/system/bookmarks_test.rbにて動作の確認を行なっているので改めての確認は不要だと考えました。

残るテストはbookmark productunbookmark productであり、これらのテストは上記「今回のテストの趣旨」で述べた内容と一緒です。

なので

RegularEventテストでは 1つのテストで一連の動作をシナリオ的にまとめている構成になっていますが

とありますが、私の認識としては

  • test/system/bookmark/products_test.rbにおける
    • bookmark product
    • unbookmark product
  • test/system/bookmark/regular_events.rbにおける
    • shows regular event link on list when clicking bookmark button
    • updates bookmarks list when toggling bookmark

はそれぞれ同じことをテストしており、テストをまとめたわけでは無いという認識です

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test/system/bookmark/products_test.rbにおける
bookmark product
unbookmark product

test/system/bookmark/regular_events.rbにおける
shows regular event link on list when clicking bookmark button
updates bookmarks list when toggling bookmark
はそれぞれ同じことをテストしており、テストをまとめたわけでは無いという認識です

すみませんでした。確かにそうですね。

is-active is-inactiveの切り替えがうまくいくか
ボタンをクリックした際にリクエストが飛ぶかどうか
等はtest/system/bookmarks_test.rbやtest/integration/api/bookmarks_test.rbで保証されていると考えました。

「ブックマーク」ボタンを押すと
ボタンの名称が「ブックマーク中」に変更され

この部分をassert_selector '#bookmark-button.is-active'ではなく文言でチェックした理由を理解できました。

私の拙い質問にも丁寧に答えてくださり、ありがとうございます!!

@smallmonkeykey
Copy link
Contributor

@tyrrell-IH
通知に気づいておらず遅くなってすみませんでした…!
1点質問させていただきました!

@tyrrell-IH tyrrell-IH force-pushed the feature/add-bookmark-button-to-regular-events branch from 9cbc3c3 to f243d29 Compare December 2, 2025 02:49
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cbc3c3 and f243d29.

📒 Files selected for processing (2)
  • app/views/regular_events/_regular_event.html.slim (1 hunks)
  • test/system/bookmark/regular_events_test.rb (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/views/regular_events/_regular_event.html.slim
🧰 Additional context used
📓 Path-based instructions (4)
test/**/*_test.rb

📄 CodeRabbit inference engine (AGENTS.md)

test/**/*_test.rb: Test suite should use Minitest with structure: system/, models/, controllers/, and fixtures in test/fixtures/; test files should be named *_test.rb
Use Minitest + Capybara for system tests; place unit and integration tests under matching test/* directories

Files:

  • test/system/bookmark/regular_events_test.rb
**/*.rb

📄 CodeRabbit inference engine (AGENTS.md)

Ruby code should use 2-space indentation, snake_case for method names, and CamelCase for class names, enforced by RuboCop (.rubocop.yml)

Files:

  • test/system/bookmark/regular_events_test.rb

⚙️ CodeRabbit configuration file

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • test/system/bookmark/regular_events_test.rb
test/**

📄 CodeRabbit inference engine (AGENTS.md)

Keep tests deterministic and use fixtures stored in test/fixtures/ for test data

Files:

  • test/system/bookmark/regular_events_test.rb
test/**/*

⚙️ CodeRabbit configuration file

test/**/*: # Test

  • TestCase名は英語で書く。
  • どうしても避けられない時以外にsystem testでsleepは使わない。

Unit Test

model, helper, decorator, view_componentについてはメソッドを追加した場合は必ず対応したUnit TestのTestCaseを1つは書く。

Files:

  • test/system/bookmark/regular_events_test.rb
🧠 Learnings (6)
📓 Common learnings
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 9306
File: app/javascript/components/Bookmarks.jsx:248-265
Timestamp: 2025-11-17T00:46:30.794Z
Learning: fjordllc/bootcamp プロジェクトでは、Reactからバニラ JavaScript への移行作業が進行中である。そのため、新しいReactファイルの作成は避け、既存のReactコンポーネント内で完結する実装が推奨される。BookmarksInDashboard.jsx は issue #9045 で削除予定。
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 9104
File: app/javascript/bookmark-button.js:5-11
Timestamp: 2025-09-28T00:36:43.971Z
Learning: fjordllc/bootcampアプリケーションでは現在、各ページにブックマークボタンは1つのみ存在し、Turbo Driveは未使用のため、querySelector での単一要素初期化とDOMContentLoadedのみのイベントリスナーで十分である。
Learnt from: mousu-a
Repo: fjordllc/bootcamp PR: 8566
File: app/views/pair_works/_body.html.slim:0-0
Timestamp: 2025-08-31T01:05:07.447Z
Learning: システムテストでボタンやフォーム要素を識別する必要がある場合、動的な値をクラス属性に埋め込むのではなく、id属性やdata属性を使用する。特にJavaScriptでの操作やコントローラーへのデータ送信が不要な場合は、id属性を使用するのが適切。
📚 Learning: 2025-11-26T08:23:30.927Z
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Applies to test/**/*_test.rb : Use Minitest + Capybara for system tests; place unit and integration tests under matching `test/*` directories

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-09-12T21:18:00.834Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-07-23T20:31:13.856Z
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 8977
File: app/controllers/reports_controller.rb:63-63
Timestamp: 2025-07-23T20:31:13.856Z
Learning: fjordllc/bootcampプロジェクトの`app/controllers/reports_controller.rb`において、`create`と`update`アクションは両方とも`report.save_uniquely`を使用し、同じ`:report_save`イベントと`'report.save'`イベントを発行する。これは両方とも本質的に「レポートの保存」操作であり、作成と更新を区別する必要がないためである。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-07-10T12:59:27.807Z
Learnt from: kitarou888
Repo: fjordllc/bootcamp PR: 8277
File: test/models/searcher_test.rb:326-331
Timestamp: 2025-07-10T12:59:27.807Z
Learning: モデルテストにおいて、1つのクラスメソッドの複数の挙動を検証する場合、機能の異なる側面を同じテストメソッドでテストすることは、包括的なテストとして適切である。特に`only_me`のような機能では、異なる検索条件(空文字と具体的な検索語)を使い分けることで、より広範囲な動作保証が可能となる。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-07-30T07:26:36.599Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 8992
File: app/models/correct_answer_notifier.rb:23-23
Timestamp: 2025-07-30T07:26:36.599Z
Learning: Railsの標準的なヘルパーメソッド(例:`question_url`、`user_path`など)が通常の方法で使用されている場合、それらの動作テストは不要である。これらのメソッドはRailsフレームワーク自体でテストされており、アプリケーション固有のロジックではないため。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (2)
test/system/bookmark/regular_events_test.rb (2)

1-8: セットアップは適切です。

クラス構造とフィクスチャの読み込みは正しく実装されています。


10-21: JavaScriptコンポーネントの初期化待機が必要です。

ブックマークボタンはJavaScriptで動作するため、products_test.rb と同様に wait_for_javascript_components の呼び出しが必要です。これがないと、JavaScriptの初期化前にテストが実行され、不安定なテストになる可能性があります。

以下のdiffを適用してください:

 test 'shows regular event link on list when clicking bookmark button' do
   visit_with_auth regular_event_path(@regular_event), 'machida'
+  wait_for_javascript_components
   assert_selector '#bookmark-button', text: 'Bookmark'
   click_button 'Bookmark'
+  wait_for_javascript_components
   assert_selector '#bookmark-button', text: 'Bookmark中'

   visit current_user_bookmarks_path
⛔ Skipped due to learnings
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 9104
File: app/javascript/bookmark-button.js:5-11
Timestamp: 2025-09-28T00:36:43.971Z
Learning: fjordllc/bootcampアプリケーションでは現在、各ページにブックマークボタンは1つのみ存在し、Turbo Driveは未使用のため、querySelector での単一要素初期化とDOMContentLoadedのみのイベントリスナーで十分である。

@tyrrell-IH
Copy link
Contributor Author

tyrrell-IH commented Dec 2, 2025

@smallmonkeykey
質問へ回答しました〜
何か質問の意図と違うところがあったら何でも聞いてください〜

あと以下の通り少し修正を加えました。

よろしくお願いします

Copy link
Contributor

@smallmonkeykey smallmonkeykey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

丁寧に答えてくださりありがとうございます。
理解できましたので、approveします!

@tyrrell-IH tyrrell-IH force-pushed the feature/add-bookmark-button-to-regular-events branch from e8165b2 to 7d8b9c7 Compare December 9, 2025 00:47
@tyrrell-IH
Copy link
Contributor Author

tyrrell-IH commented Dec 10, 2025

@okuramasafumi
お疲れ様です、フィヨルドブートキャンプ受講生のティレルと申します。

チームメンバーのレビューが終わりましたので、レビューをお願いします。

@tyrrell-IH
Copy link
Contributor Author

@okuramasafumi
すいません本PRとは直接関係ないですが、mainブランチの状態でbookmarkボタンを押してもイベントが発火しない事象が発生しています。

問題が解決したのち再度ご連絡いたしますので、一旦レビュー依頼は取り下げさせていただきます🙏

@tyrrell-IH tyrrell-IH force-pushed the feature/add-bookmark-button-to-regular-events branch from 7d8b9c7 to 874907e Compare December 12, 2025 02:24
@tyrrell-IH
Copy link
Contributor Author

@okuramasafumi
問題が解決したので、改めてレビューをお願いします🙏

Copy link
Contributor

@okuramasafumi okuramasafumi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#bookmark_buttonがテストコード中で何度も出てくるのが少し気になったのですが、ローカル変数にするのかインスタンス変数にするのかで少し迷いました。単なる文字列なので、重複は気にしないという方針もあり得ると思いました。ここではコメントするに留めておきます。


visit current_user_bookmarks_path
assert_selector 'a.card-list-item-title__link', text: @regular_event.title
click_link @regular_event.title.to_s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここのto_sは不要な気がします(同じファイルの他の箇所では使われていない)

Copy link
Contributor Author

@tyrrell-IH tyrrell-IH Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要でしたので削除しました。
commit: b38291c

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
test/system/bookmark/regular_events_test.rb (2)

10-23: テストロジックは正確で、適切にJavaScriptの初期化を待機しています。

ブックマークボタンのクリック、ブックマークリストへの表示、ページ遷移の確認が全て適切にテストされています。以前のレビューフィードバックに基づき、wait_for_javascript_componentsが正しく配置されています。

オプショナルな提案: Line 18のvisit current_user_bookmarks_pathの後にもwait_for_javascript_componentsを追加すると、より一貫性が保たれます。ただし、Capybaraのassert_selectorは要素の出現を待機するため、現状でも問題ない可能性が高いです。


25-45: ブックマークのトグル動作が包括的にテストされています。

ブックマークの追加と削除の両方の動作を確認しており、過去のコメントで議論された通り、最初のテストとは異なるシナリオを適切にカバーしています。wait_for_javascript_componentsの配置も適切です。

同様に、Line 33とLine 43の後にwait_for_javascript_componentsを追加することを検討できますが、これはオプショナルです。

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 874907e and c40a40f.

📒 Files selected for processing (1)
  • test/system/bookmark/regular_events_test.rb
🧰 Additional context used
📓 Path-based instructions (4)
test/**/*_test.rb

📄 CodeRabbit inference engine (AGENTS.md)

test/**/*_test.rb: Test suite should use Minitest with structure: system/, models/, controllers/, and fixtures in test/fixtures/; test files should be named *_test.rb
Use Minitest + Capybara for system tests; place unit and integration tests under matching test/* directories

Files:

  • test/system/bookmark/regular_events_test.rb
**/*.rb

📄 CodeRabbit inference engine (AGENTS.md)

Ruby code should use 2-space indentation, snake_case for method names, and CamelCase for class names, enforced by RuboCop (.rubocop.yml)

Files:

  • test/system/bookmark/regular_events_test.rb

⚙️ CodeRabbit configuration file

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • test/system/bookmark/regular_events_test.rb
test/**

📄 CodeRabbit inference engine (AGENTS.md)

Keep tests deterministic and use fixtures stored in test/fixtures/ for test data

Files:

  • test/system/bookmark/regular_events_test.rb
test/**/*

⚙️ CodeRabbit configuration file

test/**/*: # Test

  • TestCase名は英語で書く。
  • どうしても避けられない時以外にsystem testでsleepは使わない。

Unit Test

model, helper, decorator, view_componentについてはメソッドを追加した場合は必ず対応したUnit TestのTestCaseを1つは書く。

Files:

  • test/system/bookmark/regular_events_test.rb
🧠 Learnings (11)
📓 Common learnings
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 9306
File: app/javascript/components/Bookmarks.jsx:248-265
Timestamp: 2025-11-17T00:46:30.794Z
Learning: fjordllc/bootcamp プロジェクトでは、Reactからバニラ JavaScript への移行作業が進行中である。そのため、新しいReactファイルの作成は避け、既存のReactコンポーネント内で完結する実装が推奨される。BookmarksInDashboard.jsx は issue #9045 で削除予定。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 9104
File: app/javascript/bookmark-button.js:5-11
Timestamp: 2025-09-28T00:36:43.971Z
Learning: fjordllc/bootcampアプリケーションでは現在、各ページにブックマークボタンは1つのみ存在し、Turbo Driveは未使用のため、querySelector での単一要素初期化とDOMContentLoadedのみのイベントリスナーで十分である。
📚 Learning: 2025-11-26T08:23:30.927Z
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Applies to test/**/*_test.rb : Use Minitest + Capybara for system tests; place unit and integration tests under matching `test/*` directories

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-11-26T08:23:30.927Z
Learnt from: CR
Repo: fjordllc/bootcamp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-26T08:23:30.927Z
Learning: Applies to test/**/*_test.rb : Test suite should use Minitest with structure: `system/`, `models/`, `controllers/`, and fixtures in `test/fixtures/`; test files should be named `*_test.rb`

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-09-12T21:18:00.834Z
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-07-23T20:31:13.856Z
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 8977
File: app/controllers/reports_controller.rb:63-63
Timestamp: 2025-07-23T20:31:13.856Z
Learning: fjordllc/bootcampプロジェクトの`app/controllers/reports_controller.rb`において、`create`と`update`アクションは両方とも`report.save_uniquely`を使用し、同じ`:report_save`イベントと`'report.save'`イベントを発行する。これは両方とも本質的に「レポートの保存」操作であり、作成と更新を区別する必要がないためである。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-07-10T12:59:27.807Z
Learnt from: kitarou888
Repo: fjordllc/bootcamp PR: 8277
File: test/models/searcher_test.rb:326-331
Timestamp: 2025-07-10T12:59:27.807Z
Learning: モデルテストにおいて、1つのクラスメソッドの複数の挙動を検証する場合、機能の異なる側面を同じテストメソッドでテストすることは、包括的なテストとして適切である。特に`only_me`のような機能では、異なる検索条件(空文字と具体的な検索語)を使い分けることで、より広範囲な動作保証が可能となる。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-07-30T07:26:36.599Z
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 8992
File: app/models/correct_answer_notifier.rb:23-23
Timestamp: 2025-07-30T07:26:36.599Z
Learning: Railsの標準的なヘルパーメソッド(例:`question_url`、`user_path`など)が通常の方法で使用されている場合、それらの動作テストは不要である。これらのメソッドはRailsフレームワーク自体でテストされており、アプリケーション固有のロジックではないため。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-09-28T00:36:43.971Z
Learnt from: jun-kondo
Repo: fjordllc/bootcamp PR: 9104
File: app/javascript/bookmark-button.js:5-11
Timestamp: 2025-09-28T00:36:43.971Z
Learning: fjordllc/bootcampアプリケーションでは現在、各ページにブックマークボタンは1つのみ存在し、Turbo Driveは未使用のため、querySelector での単一要素初期化とDOMContentLoadedのみのイベントリスナーで十分である。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-11-17T00:46:30.794Z
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 9306
File: app/javascript/components/Bookmarks.jsx:248-265
Timestamp: 2025-11-17T00:46:30.794Z
Learning: fjordllc/bootcamp プロジェクトでは、Reactからバニラ JavaScript への移行作業が進行中である。そのため、新しいReactファイルの作成は避け、既存のReactコンポーネント内で完結する実装が推奨される。BookmarksInDashboard.jsx は issue #9045 で削除予定。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-09-04T01:39:22.261Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 9102
File: app/controllers/mentor/buzzes_controller.rb:0-0
Timestamp: 2025-09-04T01:39:22.261Z
Learning: fjordllc/bootcamp プロジェクトでは、更新処理の成功時の通知メッセージについて、I18n を使用せずに日本語文字列を直接記述する方針で一貫性を保っている。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
📚 Learning: 2025-07-15T04:26:24.899Z
Learnt from: masyuko0222
Repo: fjordllc/bootcamp PR: 8934
File: app/controllers/test_feature_toggle_controller.rb:4-6
Timestamp: 2025-07-15T04:26:24.899Z
Learning: テスト用の一時的なコードで、すぐにリバートされる予定の場合、nil安全性などの防御的プログラミングの実装は不要とされることがある。

Applied to files:

  • test/system/bookmark/regular_events_test.rb
🧬 Code graph analysis (1)
test/system/bookmark/regular_events_test.rb (1)
test/supports/javascript_helper.rb (1)
  • wait_for_javascript_components (5-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (1)
test/system/bookmark/regular_events_test.rb (1)

1-8: LGTM! テストのセットアップは適切です。

ファイル構造、命名規則、fixtureの使用方法が全てプロジェクトの規約に従っています。

@tyrrell-IH tyrrell-IH force-pushed the feature/add-bookmark-button-to-regular-events branch from c40a40f to f389c49 Compare December 27, 2025 01:37
@tyrrell-IH
Copy link
Contributor Author

tyrrell-IH commented Dec 27, 2025

@smallmonkeykey
すいません、一度レビューしていただきapproveをいただいたと思うのですが、少し仕様の変更があったので再度レビューをお願いできませんでしょうか?

以下に内容の詳細を書きますが、わからないことがあったら何でも聞いてください〜🙏

変更になった箇所

  • /current_user/bookmarks
  • /(ダッシュボードのブックマーク欄)

それぞれのブックマーク一覧表示のラベルの部分↓
_development__ダッシュボード___FBC
について改行の対応をしていなかったのですが、今回改めて改行の対応を行いました。

commit: f389c49

以前の対応状況についてはここに残していますのでご参照ください。

なぜ今回改行の対応をするように変更したのか

descriptionsにも記載していますが、ラベルの表示を実装している箇所は

  • /current_user/bookmarksBookmarks.jsx
  • /(ダッシュボードのブックマーク欄)BookmarksInDashboard.jsx

にてそれぞれ実装されていましたが、各ファイルはそれぞれ

にて削除(バニラJSで再実装)予定であり、私が本PRを作成した当初ではどのPRが先にマージされるかわからず、ラベル改行の実装方法が未定の状態だったので、全てのPRがmainにマージされるのを待ってから別Issueにて改行の対応を行う予定でした。

しかし現在は

  • リサさんのPR → mainにマージ済み
  • matuayaさんのPR → Draft状態(4ヶ月前から進捗がないので、、マージまでまだ時間がかかると思われる)

という状況なので、本PRにて改行の対応を行い、matuayaさんには本PRを参考に改行の対応をしていただくよう連絡したいと思います。

@okuramasafumi
上記の通りチームメンバーに再レビュー依頼を行いました。
チームメンバーの再レビューが終わり次第、大倉さん宛に再度メンションいたします。

ご迷惑おかけしますがよろしくお願いいたします🙏
`

Copy link
Contributor

@smallmonkeykey smallmonkeykey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tyrrell-IH
お待たせしてすみません。とても丁寧に説明してくださってありがとうございます。
コードもキレイで読みやすいと感じました。approveします。

@tyrrell-IH
Copy link
Contributor Author

tyrrell-IH commented Jan 11, 2026

@smallmonkeykey
お忙しい中追加のレビューを受けていただきありがとうございました🙏

@okuramasafumi
遅くなりましたが前回の指摘事項の修正+追加の修正がありますので再度レビューをお願いしたいです。

追加の修正

#9306 (comment)
に経緯を書いていますので、ご参照ください。
commit: f389c49

前回の指摘事項

#9306 (comment)

不要なto_sを削除しました。
commit: b38291c

その他指摘事項について

#9306 (review)
のコメントについて

例えばインスタンス変数する方向で考えた時に
@bookmark_button = '#bookmark_button'
のような感じだと可読性的にもあまり変わらないかなと考えたので、文字列のままにしています。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants