-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Q&A]質問の本公開時にメンター側のWatchを自動的にonにするように修正 #4530
[Q&A]質問の本公開時にメンター側のWatchを自動的にonにするように修正 #4530
Conversation
@taka110-IT |
@Paru871 さん |
@taka110-IT |
@aim2bpg |
@Paru871 |
within 'form[name=question]' do | ||
fill_in 'question[title]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト' | ||
fill_in 'question[description]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト' | ||
click_button '登録する' | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
click_button
がブロック内外にありますので統一した方が良いかと思いました。
本ファイルを上から見ていくと、ブロック内で統一された方がよさそうです。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます!
今回作成したテスト3つについて、ブロック内にclick_button
を書くように統一いたしました。
within 'form[name=question]' do | ||
fill_in 'question[title]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト' | ||
fill_in 'question[description]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト' | ||
click_button '登録する' | ||
end | ||
visit_with_auth questions_path, 'komagata' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visit_with_auth
の前に空行があると見やすくなるのではと思いました。
そういえば、この前には「質問を作成しました。」はチェックされないのですね。
以降では、メッセージをチェックしているのでここも統一感を持たせた方が良いかと思いました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
「質問を作成しました。」のチェックが抜けていましたので追加しました。
見つけてくださってありがとうございます!助かりましたー🙏
統一感が大事、しっかり覚えたいと思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visit_with_auth
の前に空行を作るのも、今回作成した3つのテストについて統一して修正しました。
ありがとうございます!
test/system/questions_test.rb
Outdated
within 'form[name=question]' do | ||
fill_in 'question[title]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト' | ||
fill_in 'question[description]', with: 'メンターのみ投稿された質問が"Watch中"になるテスト' | ||
click_button '登録する' | ||
end | ||
visit_with_auth questions_path, 'komagata' | ||
click_link 'メンターのみ投稿された質問が"Watch中"になるテスト' | ||
assert_text 'kimura (Kimura Tadasi)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一覧ページではなく、詳細ページであることの確認意図でユーザー名をチェックされているのかと思いました。だとすると、一覧ページにも出現しますので、違う目印が良いかもです。例えば「削除する」など。。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
確かに書いてくださったとおりだと思いました!ありがとうございました。
ご提案いただいた「削除する」が良いと思いましたので採用させていただき、今回作成した3つのテストについて詳細ページであることを確認する項目として修正を行いました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
動作確認で問題ないことを確認しました。手順がわかりやすくて助かりました。
テストの書き方でいくつかコメントさせていただきました。
ご確認をお願いいたします〜🙏
@Paru871 さん、久しぶりでメンション忘れてましたので、本コメントでメンション飛ばさせていただきます🙏 |
9ca3b0d
to
b336f1b
Compare
@aim2bpg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Paru871 さん、修正ありがとうございます。
私はOKです🙆♀️
@aim2bpg |
@komagata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
確認しました、OKですー🙆♂️
Issue
概要
Q&AのWIP機能の付加(#4157)により、質問が作成された際に自動的にメンターさんのみ「Watch中」になるタイミングがWIP保存時にも働いてしまうため、タイミングを「本公開時」にWatch中になるよう修正しました。
参考PR
Refs: #3120
修正の内容
app/controllers/questions_controller.rb
にて実装していましたが、app/models/question_callbacks.rb
のafter_save
内へ移動させ、質問の初回の本公開時に行うように変更しました。insert_all
を使うことと、ここにrubocopの指摘が入るのを無効化することは、以前の実装時の受講生とアドバイザーさん、駒形さんとのやり取り・指示をそのまま受け継ぎました。詳細は下記のコメントをご覧ください。
https://github.com/fjordllc/bootcamp/pull/3120/files#r700293736
修正前
修正後
WIPで保存時には「Watch中」ボタンがonにならない
質問の本公開時には「Watch中」ボタンがonになる
動作確認手順
bin/setup
rails db:reset
を行い初期化した後、rails s
にて開発環境を立ち上げる