Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/helpers/page_tabs/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def user_page_tabs(user, active_tab:)
tabs << { name: '質問', link: user_questions_path(user), count: user.questions.length }
tabs << { name: '回答', link: user_answers_path(user), count: user.answers.length }
tabs << { name: 'イベント', link: user_events_path(user), count: user.participate_events.length }
if Rails.env.in? %w[development test]
if Switchlet.enabled?(:micro_report) && (admin_or_mentor_login? || (Rails.env.in? %w[development test]))
tabs << { name: '分報',
link: "#{user_micro_reports_path(user, page: user.latest_micro_report_page)}#latest-micro-report",
count: user.micro_reports.length }
Expand Down
6 changes: 6 additions & 0 deletions app/views/application/_global_nav.slim
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@ nav.global-nav
.global-nav__item-count.a-notification-count.is-only-mentor
= Talk.action_uncompleted.count
.global-nav-links__link-label 相談
- if Switchlet.enabled?(:micro_report) && (admin_or_mentor_login? || (Rails.env.in? %w[development test]))
li.global-nav-links__item
= link_to "#{user_micro_reports_path(current_user, page: current_user.latest_micro_report_page)}#latest-micro-report", class: "global-nav-links__link #{current_link(/micro_reports/)}" do
.global-nav-links__link-icon
i.fa-solid.fa-clock
.global-nav-links__link-label 分報
6 changes: 5 additions & 1 deletion test/system/user/micro_reports_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
require 'application_system_test_case'

class MicroReportsTest < ApplicationSystemTestCase
setup do
Switchlet.enable!(:micro_report)
end

test 'show all micro reports of the target user' do
visit_with_auth user_micro_reports_path(users(:hajime)), 'hatsuno'
assert_text '分報 (3)'
assert_text '最初の分報'
assert_text '2つ目の分報'
assert_text '最初の分報'
assert_text '最新の分報'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ここってなにかあって修正した感じでしょうか?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

コミットメッセージに記載しておらず、失礼いたしました。🙇‍♀️
test/fixtures/micro_reports.ymlの内容が以下であるため、誤記("最新"を"最初"と誤って記載した)と思い、併せて修正いたしました。

hajime_first_micro_report:
  user: hajime
  content: 最初の分報
  created_at: <%= 2.day.ago %>

hajime_second_micro_report:
  user: hajime
  content: 2つ目の分報
  created_at: <%= 1.day.ago %>

hajime_third_micro_report:
  user: hajime
  content: 最新の分報

Copy link
Copy Markdown
Member

@komagata komagata Nov 3, 2025

Choose a reason for hiding this comment

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

@sjabcdefin すみません、僕の書き方がわかりずらかったです。

これまでテストが成功していたとしたら、なぜassert_textの文章を変更したのにテストが成功するのでしょうか?
(実装自体を修正した形跡が見当たらなかったので)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@komagata
本日の質問・雑談タイムでお話させていただいた内容を以下コメントに残します。😌🙏

  • 指摘いただいたテストの実装自体は修正していない。
  • 分報のテストデータが以下となっているため、修正前でも問題なくテストはパスする
    ('最初の分報'を2回テストしている)
  • 誤記("最新"を"最初"と誤って記載した)と思い、併せて修正した。

test/fixtures/micro_reports.yml

hajime_first_micro_report:
  user: hajime
  content: 最初の分報
  created_at: <%= 2.day.ago %>

hajime_second_micro_report:
  user: hajime
  content: 2つ目の分報
  created_at: <%= 1.day.ago %>

hajime_third_micro_report:
  user: hajime
  content: 最新の分報

ご確認お願いいたします。😌🙏

end

test 'micro reports are ordered by created_at asc' do
Expand Down