From a8f83e57571b889147811603a4b7a28cc50a1e4c Mon Sep 17 00:00:00 2001 From: masyuko0222 Date: Mon, 5 Feb 2024 21:00:29 +0900 Subject: [PATCH 1/3] =?UTF-8?q?rubocop=E3=81=AE=E3=83=AB=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=81=8B=E3=82=89=E9=99=A4=E5=A4=96=E3=81=95=E3=82=8C=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=9F=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92?= =?UTF-8?q?=E3=80=81=E9=81=A9=E7=94=A8=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop_todo.yml | 12 -- test/deliveries/activity_delivery_test.rb | 16 +-- test/mailers/activity_mailer_test.rb | 136 +++++++++--------- test/mailers/notification_mailer_test.rb | 2 +- .../previews/activity_mailer_preview.rb | 54 +++---- .../previews/notification_mailer_preview.rb | 14 +- test/models/answer_test.rb | 2 +- test/models/bookmark_test.rb | 20 +-- test/models/category_test.rb | 2 +- test/models/discord/times_channel_test.rb | 2 +- test/models/event_test.rb | 2 +- 11 files changed, 125 insertions(+), 137 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3bae12090f3..2f751e026e3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -11,15 +11,3 @@ # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys # SupportedShorthandSyntax: always, never, either, consistent -Style/HashSyntax: - Exclude: - - 'test/deliveries/activity_delivery_test.rb' - - 'test/mailers/activity_mailer_test.rb' - - 'test/mailers/notification_mailer_test.rb' - - 'test/mailers/previews/activity_mailer_preview.rb' - - 'test/mailers/previews/notification_mailer_preview.rb' - - 'test/models/answer_test.rb' - - 'test/models/bookmark_test.rb' - - 'test/models/category_test.rb' - - 'test/models/discord/times_channel_test.rb' - - 'test/models/event_test.rb' diff --git a/test/deliveries/activity_delivery_test.rb b/test/deliveries/activity_delivery_test.rb index 6f22e15bbe1..8c634c6f100 100644 --- a/test/deliveries/activity_delivery_test.rb +++ b/test/deliveries/activity_delivery_test.rb @@ -42,7 +42,7 @@ class ActivityDeliveryTest < ActiveSupport::TestCase test '.notify(:checked)' do check = checks(:procuct2_check_komagata) params = { - check: check, + check:, receiver: check.receiver } @@ -107,7 +107,7 @@ class ActivityDeliveryTest < ActiveSupport::TestCase test '.notify(:submitted)' do product = products(:product6) params = { - product: product, + product:, receiver: users(:mentormentaro) } @@ -204,7 +204,7 @@ class ActivityDeliveryTest < ActiveSupport::TestCase test '.notify(:assigned_as_checker)' do product = products(:product64) params = { - product: product, + product:, receiver: User.find(product.checker_id) } @@ -251,7 +251,7 @@ class ActivityDeliveryTest < ActiveSupport::TestCase test '.notify(:first_report)' do report = reports(:report10) params = { - report: report, + report:, receiver: users(:komagata) } @@ -298,7 +298,7 @@ class ActivityDeliveryTest < ActiveSupport::TestCase test '.notify(:update_regular_event)' do regular_event = regular_events(:regular_event1) params = { - regular_event: regular_event, + regular_event:, receiver: users(:komagata) } @@ -348,7 +348,7 @@ class ActivityDeliveryTest < ActiveSupport::TestCase test '.notify(:chose_correct_answer)' do answer = answers(:answer1) params = { - answer: answer, + answer:, receiver: answer.user } @@ -372,7 +372,7 @@ class ActivityDeliveryTest < ActiveSupport::TestCase test '.notify(:no_correct_answer)' do question = questions(:question1) params = { - question: question, + question:, receiver: question.user } @@ -421,7 +421,7 @@ class ActivityDeliveryTest < ActiveSupport::TestCase commentable_path = Rails.application.routes.url_helpers.polymorphic_path(comment.commentable) params = { - comment: comment, + comment:, receiver: comment.receiver, message: "相談部屋で#{comment.sender.login_name}さんからコメントがありました。", link: "#{commentable_path}#latest-comment" diff --git a/test/mailers/activity_mailer_test.rb b/test/mailers/activity_mailer_test.rb index 6256aab619e..e3f55145ceb 100644 --- a/test/mailers/activity_mailer_test.rb +++ b/test/mailers/activity_mailer_test.rb @@ -99,7 +99,7 @@ class ActivityMailerTest < ActionMailer::TestCase test 'came_answer' do answer = answers(:answer3) - ActivityMailer.came_answer(answer: answer).deliver_now + ActivityMailer.came_answer(answer:).deliver_now assert_not ActionMailer::Base.deliveries.empty? email = ActionMailer::Base.deliveries.last @@ -112,7 +112,7 @@ class ActivityMailerTest < ActionMailer::TestCase test 'came_answer with params' do answer = answers(:answer3) - mailer = ActivityMailer.with(answer: answer).came_answer + mailer = ActivityMailer.with(answer:).came_answer perform_enqueued_jobs do mailer.deliver_later @@ -153,7 +153,7 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = users(:sotugyou) ActivityMailer.post_announcement( announcement: announce, - receiver: receiver + receiver: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -170,7 +170,7 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = users(:sotugyou) mailer = ActivityMailer.with( announcement: announce, - receiver: receiver + receiver: ).post_announcement perform_enqueued_jobs do @@ -193,28 +193,28 @@ class ActivityMailerTest < ActionMailer::TestCase receiver.update_columns(mail_notification: false, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.post_announcement( announcement: announce, - receiver: receiver + receiver: ).deliver_now assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: false, retired_on: Date.current) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.post_announcement( announcement: announce, - receiver: receiver + receiver: ).deliver_now assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: true, retired_on: Date.current) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.post_announcement( announcement: announce, - receiver: receiver + receiver: ).deliver_now assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: true, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.post_announcement( announcement: announce, - receiver: receiver + receiver: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? end @@ -227,7 +227,7 @@ class ActivityMailerTest < ActionMailer::TestCase ActivityMailer.came_question( sender: user, receiver: mentor, - question: question + question: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -247,7 +247,7 @@ class ActivityMailerTest < ActionMailer::TestCase mailer = ActivityMailer.with( sender: user, receiver: mentor, - question: question + question: ).came_question perform_enqueued_jobs do @@ -267,7 +267,7 @@ class ActivityMailerTest < ActionMailer::TestCase mentionable = comments(:comment9) mentioned = notifications(:notification_mentioned) ActivityMailer.mentioned( - mentionable: mentionable, + mentionable:, receiver: mentioned.user ).deliver_now @@ -284,7 +284,7 @@ class ActivityMailerTest < ActionMailer::TestCase mentionable = comments(:comment9) mentioned = notifications(:notification_mentioned) mailer = ActivityMailer.with( - mentionable: mentionable, + mentionable:, receiver: mentioned.user ).mentioned @@ -307,28 +307,28 @@ class ActivityMailerTest < ActionMailer::TestCase mentioned.user.update_columns(mail_notification: false, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.mentioned( - mentionable: mentionable, + mentionable:, receiver: mentioned.user ).deliver_now assert_empty ActionMailer::Base.deliveries mentioned.user.update_columns(mail_notification: false, retired_on: Date.current) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.mentioned( - mentionable: mentionable, + mentionable:, receiver: mentioned.user ).deliver_now assert_empty ActionMailer::Base.deliveries mentioned.user.update_columns(mail_notification: true, retired_on: Date.current) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.mentioned( - mentionable: mentionable, + mentionable:, receiver: mentioned.user ).deliver_now assert_empty ActionMailer::Base.deliveries mentioned.user.update_columns(mail_notification: true, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.mentioned( - mentionable: mentionable, + mentionable:, receiver: mentioned.user ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -387,7 +387,7 @@ class ActivityMailerTest < ActionMailer::TestCase ActivityMailer.checked( sender: check.sender, receiver: check.receiver, - check: check + check: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -404,7 +404,7 @@ class ActivityMailerTest < ActionMailer::TestCase mailer = ActivityMailer.with( sender: check.sender, receiver: check.receiver, - check: check + check: ).checked perform_enqueued_jobs do @@ -424,7 +424,7 @@ class ActivityMailerTest < ActionMailer::TestCase ActivityMailer.checked( sender: check.sender, receiver: users(:hajime), - check: check + check: ).deliver_now assert_empty ActionMailer::Base.deliveries @@ -435,8 +435,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = users(:mentormentaro) ActivityMailer.create_page( - page: page, - receiver: receiver + page:, + receiver: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -453,8 +453,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = users(:mentormentaro) mailer = ActivityMailer.with( - page: page, - receiver: receiver + page:, + receiver: ).create_page perform_enqueued_jobs do @@ -475,7 +475,7 @@ class ActivityMailerTest < ActionMailer::TestCase notification = notifications(:notification_moved_up_event_waiting_user) ActivityMailer.moved_up_event_waiting_user( receiver: notification.user, - event: event + event: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -492,7 +492,7 @@ class ActivityMailerTest < ActionMailer::TestCase notification = notifications(:notification_moved_up_event_waiting_user) mailer = ActivityMailer.moved_up_event_waiting_user( receiver: notification.user, - event: event + event: ) perform_enqueued_jobs do @@ -513,8 +513,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = users(:mentormentaro) ActivityMailer.submitted( - receiver: receiver, - product: product + receiver:, + product: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -531,8 +531,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = users(:mentormentaro) mailer = ActivityMailer.with( - receiver: receiver, - product: product + receiver:, + product: ).submitted perform_enqueued_jobs do @@ -553,8 +553,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = users(:hajime) ActivityMailer.submitted( - receiver: receiver, - product: product + receiver:, + product: ).deliver_now assert_empty ActionMailer::Base.deliveries @@ -567,8 +567,8 @@ class ActivityMailerTest < ActionMailer::TestCase ActivityMailer.following_report( sender: user, - receiver: receiver, - report: report + receiver:, + report: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -587,8 +587,8 @@ class ActivityMailerTest < ActionMailer::TestCase mailer = ActivityMailer.with( sender: user, - receiver: receiver, - report: report + receiver:, + report: ).following_report perform_enqueued_jobs do @@ -631,8 +631,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = User.find(product.checker_id) ActivityMailer.assigned_as_checker( - product: product, - receiver: receiver + product:, + receiver: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -649,8 +649,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = User.find(product.checker_id) mailer = ActivityMailer.with( - product: product, - receiver: receiver + product:, + receiver: ).assigned_as_checker perform_enqueued_jobs do @@ -672,29 +672,29 @@ class ActivityMailerTest < ActionMailer::TestCase receiver.update_columns(mail_notification: false, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.assigned_as_checker( - product: product, - receiver: receiver + product:, + receiver: ).deliver_now assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: false, retired_on: Date.current) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.assigned_as_checker( - product: product, - receiver: receiver + product:, + receiver: ).deliver_now assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: true, retired_on: Date.current) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.assigned_as_checker( - product: product, - receiver: receiver + product:, + receiver: ).deliver_now assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: true, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.assigned_as_checker( - product: product, - receiver: receiver + product:, + receiver: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? end @@ -755,7 +755,7 @@ class ActivityMailerTest < ActionMailer::TestCase report = reports(:report10) first_report = notifications(:notification_first_report) ActivityMailer.first_report( - report: report, + report:, receiver: first_report.user ).deliver_now @@ -771,7 +771,7 @@ class ActivityMailerTest < ActionMailer::TestCase report = reports(:report10) first_report = notifications(:notification_first_report) mailer = ActivityMailer.with( - report: report, + report:, receiver: first_report.user ).first_report @@ -791,7 +791,7 @@ class ActivityMailerTest < ActionMailer::TestCase report = reports(:report16) consecutive_sad_report = notifications(:notification_consecutive_sad_report) ActivityMailer.consecutive_sad_report( - report: report, + report:, receiver: consecutive_sad_report.user ).deliver_now @@ -808,7 +808,7 @@ class ActivityMailerTest < ActionMailer::TestCase report = reports(:report16) consecutive_sad_report = notifications(:notification_consecutive_sad_report) mailer = ActivityMailer.with( - report: report, + report:, receiver: consecutive_sad_report.user ).consecutive_sad_report @@ -830,7 +830,7 @@ class ActivityMailerTest < ActionMailer::TestCase notification = notifications(:notification_regular_event_updated) ActivityMailer.update_regular_event( - regular_event: regular_event, + regular_event:, receiver: notification.user ).deliver_now @@ -847,7 +847,7 @@ class ActivityMailerTest < ActionMailer::TestCase notification = notifications(:notification_regular_event_updated) mailer = ActivityMailer.with( - regular_event: regular_event, + regular_event:, receiver: notification.user ).update_regular_event @@ -921,8 +921,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = answer.user ActivityMailer.chose_correct_answer( - answer: answer, - receiver: receiver + answer:, + receiver: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -939,8 +939,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = answer.user mailer = ActivityMailer.with( - answer: answer, - receiver: receiver + answer:, + receiver: ).chose_correct_answer perform_enqueued_jobs do @@ -962,8 +962,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver.update(mail_notification: false) mailer = ActivityMailer.with( - answer: answer, - receiver: receiver + answer:, + receiver: ).chose_correct_answer perform_enqueued_jobs do @@ -979,8 +979,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver.update(retired_on: Date.current) mailer = ActivityMailer.with( - answer: answer, - receiver: receiver + answer:, + receiver: ).chose_correct_answer perform_enqueued_jobs do @@ -994,7 +994,7 @@ class ActivityMailerTest < ActionMailer::TestCase question = questions(:question1) receiver = question.user - ActivityMailer.no_correct_answer(question: question, receiver: receiver).deliver_now + ActivityMailer.no_correct_answer(question:, receiver:).deliver_now assert_not ActionMailer::Base.deliveries.empty? email = ActionMailer::Base.deliveries.last @@ -1009,7 +1009,7 @@ class ActivityMailerTest < ActionMailer::TestCase question = questions(:question1) receiver = question.user - mailer = ActivityMailer.with(question: question, receiver: receiver).no_correct_answer + mailer = ActivityMailer.with(question:, receiver:).no_correct_answer perform_enqueued_jobs do mailer.deliver_later @@ -1029,8 +1029,8 @@ class ActivityMailerTest < ActionMailer::TestCase receiver = users(:komagata) ActivityMailer.product_update( - product: product, - receiver: receiver + product:, + receiver: ).deliver_now assert_not ActionMailer::Base.deliveries.empty? @@ -1056,7 +1056,7 @@ class ActivityMailerTest < ActionMailer::TestCase ) ActivityMailer.came_comment( - comment: comment, + comment:, message: "相談部屋で#{comment.sender.login_name}さんからコメントがありました。", receiver: comment.receiver ).deliver_now @@ -1083,7 +1083,7 @@ class ActivityMailerTest < ActionMailer::TestCase ) mailer = ActivityMailer.with( - comment: comment, + comment:, message: "相談部屋で#{comment.sender.login_name}さんからコメントがありました。", receiver: comment.receiver ).came_comment @@ -1107,7 +1107,7 @@ class ActivityMailerTest < ActionMailer::TestCase comment = comments(:commentOfTalk) ActivityMailer.came_comment( - comment: comment, + comment:, message: "相談部屋で#{comment.sender.login_name}さんからコメントがありました。", receiver: comment.receiver ).deliver_now diff --git a/test/mailers/notification_mailer_test.rb b/test/mailers/notification_mailer_test.rb index 7eb12877564..9f52c4cdca4 100644 --- a/test/mailers/notification_mailer_test.rb +++ b/test/mailers/notification_mailer_test.rb @@ -7,7 +7,7 @@ class NotificationMailerTest < ActionMailer::TestCase report = reports(:report11) trainee_report = notifications(:notification_trainee_report) mailer = NotificationMailer.with( - report: report, + report:, receiver: trainee_report.user ).trainee_report diff --git a/test/mailers/previews/activity_mailer_preview.rb b/test/mailers/previews/activity_mailer_preview.rb index 4f8f84ea930..98b4aa8ef9e 100644 --- a/test/mailers/previews/activity_mailer_preview.rb +++ b/test/mailers/previews/activity_mailer_preview.rb @@ -7,7 +7,7 @@ def came_comment comment = Comment.find(ActiveRecord::FixtureSet.identify(:commentOfTalk)) ActivityMailer.with( - comment: comment, + comment:, message: "相談部屋で#{comment.sender.login_name}さんからコメントがありました。", receiver: comment.receiver ).came_comment @@ -17,19 +17,19 @@ def graduated sender = User.find(ActiveRecord::FixtureSet.identify(:sotugyou)) receiver = User.find(ActiveRecord::FixtureSet.identify(:mentormentaro)) - ActivityMailer.with(sender: sender, receiver: receiver).graduated + ActivityMailer.with(sender:, receiver:).graduated end def checked check = Check.find(ActiveRecord::FixtureSet.identify(:procuct2_check_komagata)) - ActivityMailer.with(receiver: check.receiver, check: check).checked + ActivityMailer.with(receiver: check.receiver, check:).checked end def came_answer question = Question.find(ActiveRecord::FixtureSet.identify(:question2)) answer = question.answers.first - ActivityMailer.with(answer: answer).came_answer + ActivityMailer.with(answer:).came_answer end def post_announcement @@ -38,7 +38,7 @@ def post_announcement ActivityMailer.with( announcement: announce, - receiver: receiver + receiver: ).post_announcement end @@ -46,14 +46,14 @@ def came_question receiver = User.find(ActiveRecord::FixtureSet.identify(:komagata)) question = Question.find(ActiveRecord::FixtureSet.identify(:question1)) - ActivityMailer.with(sender: question.user, receiver: receiver, question: question).came_question + ActivityMailer.with(sender: question.user, receiver:, question:).came_question end def retired sender = User.find(ActiveRecord::FixtureSet.identify(:yameo)) receiver = User.find(ActiveRecord::FixtureSet.identify(:mentormentaro)) - ActivityMailer.with(sender: sender, receiver: receiver).retired + ActivityMailer.with(sender:, receiver:).retired end def mentioned @@ -61,14 +61,14 @@ def mentioned report = Report.find(ActiveRecord::FixtureSet.identify(:report5)) receiver = report.user - ActivityMailer.with(mentionable: mentionable, receiver: receiver).mentioned + ActivityMailer.with(mentionable:, receiver:).mentioned end def create_page page = Page.find(ActiveRecord::FixtureSet.identify(:page4)) receiver = User.find(ActiveRecord::FixtureSet.identify(:mentormentaro)) - ActivityMailer.with(sender: page.user, receiver: receiver, page: page).create_page + ActivityMailer.with(sender: page.user, receiver:, page:).create_page end def moved_up_event_waiting_user @@ -76,8 +76,8 @@ def moved_up_event_waiting_user receiver = User.find(ActiveRecord::FixtureSet.identify(:hatsuno)) ActivityMailer.with( - event: event, - receiver: receiver + event:, + receiver: ).moved_up_event_waiting_user end @@ -85,7 +85,7 @@ def submitted product = Product.find(ActiveRecord::FixtureSet.identify(:product15)) receiver = User.find(ActiveRecord::FixtureSet.identify(:mentormentaro)) - ActivityMailer.with(product: product, receiver: receiver).submitted + ActivityMailer.with(product:, receiver:).submitted end def following_report @@ -94,9 +94,9 @@ def following_report receiver = User.find(ActiveRecord::FixtureSet.identify(:muryou)) ActivityMailer.with( - report: report, - sender: sender, - receiver: receiver + report:, + sender:, + receiver: ).following_report end @@ -107,10 +107,10 @@ def watching_noitification sender = comment.user ActivityMailer.with( - watchable: watchable, - receiver: receiver, - sender: sender, - comment: comment + watchable:, + receiver:, + sender:, + comment: ).watching_notification end @@ -118,21 +118,21 @@ def assigned_as_checker product = Product.find(ActiveRecord::FixtureSet.identify(:product71)) receiver = User.find(product.checker_id) - ActivityMailer.with(product: product, receiver: receiver).assigned_as_checker + ActivityMailer.with(product:, receiver:).assigned_as_checker end def hibernated sender = User.find(ActiveRecord::FixtureSet.identify(:hatsuno)) receiver = User.find(ActiveRecord::FixtureSet.identify(:mentormentaro)) - ActivityMailer.with(sender: sender, receiver: receiver).hibernated + ActivityMailer.with(sender:, receiver:).hibernated end def first_report report = Report.find(ActiveRecord::FixtureSet.identify(:report10)) receiver = User.find(ActiveRecord::FixtureSet.identify(:komagata)) - ActivityMailer.with(report: report, receiver: receiver).first_report + ActivityMailer.with(report:, receiver:).first_report end def consecutive_sad_report @@ -140,34 +140,34 @@ def consecutive_sad_report notification = Notification.find(ActiveRecord::FixtureSet.identify(:notification_consecutive_sad_report)) receiver = notification.user - ActivityMailer.with(report: report, receiver: receiver).consecutive_sad_report + ActivityMailer.with(report:, receiver:).consecutive_sad_report end def update_regular_event regular_event = RegularEvent.find(ActiveRecord::FixtureSet.identify(:regular_event1)) receiver = User.find(ActiveRecord::FixtureSet.identify(:hatsuno)) - ActivityMailer.with(regular_event: regular_event, receiver: receiver).update_regular_event + ActivityMailer.with(regular_event:, receiver:).update_regular_event end def signed_up sender = ActiveDecorator::Decorator.instance.decorate(User.find(ActiveRecord::FixtureSet.identify(:hajime))) receiver = User.find(ActiveRecord::FixtureSet.identify(:komagata)) - ActivityMailer.with(sender: sender, receiver: receiver, sender_roles: sender.roles_to_s).signed_up + ActivityMailer.with(sender:, receiver:, sender_roles: sender.roles_to_s).signed_up end def chose_correct_answer answer = Answer.find(ActiveRecord::FixtureSet.identify(:correct_answer1)) receiver = User.find(answer.user_id) - ActivityMailer.with(answer: answer, receiver: receiver).chose_correct_answer + ActivityMailer.with(answer:, receiver:).chose_correct_answer end def no_correct_answer question = Question.find(ActiveRecord::FixtureSet.identify(:question1)) receiver = User.find(question.user_id) - ActivityMailer.with(question: question, receiver: receiver).no_correct_answer + ActivityMailer.with(question:, receiver:).no_correct_answer end end diff --git a/test/mailers/previews/notification_mailer_preview.rb b/test/mailers/previews/notification_mailer_preview.rb index b73623a4886..7ced2eed3b0 100644 --- a/test/mailers/previews/notification_mailer_preview.rb +++ b/test/mailers/previews/notification_mailer_preview.rb @@ -8,48 +8,48 @@ def mentioned mentionable = Comment.find(ActiveRecord::FixtureSet.identify(:comment9)) receiver = report.user - NotificationMailer.with(mentionable: mentionable, receiver: receiver).mentioned + NotificationMailer.with(mentionable:, receiver:).mentioned end def checked report = Report.find(ActiveRecord::FixtureSet.identify(:report5)) check = report.checks.first - NotificationMailer.with(check: check).checked + NotificationMailer.with(check:).checked end def retired sender = User.find(ActiveRecord::FixtureSet.identify(:yameo)) receiver = User.find(ActiveRecord::FixtureSet.identify(:komagata)) - NotificationMailer.with(sender: sender, receiver: receiver).retired + NotificationMailer.with(sender:, receiver:).retired end def trainee_report report = Report.find(ActiveRecord::FixtureSet.identify(:report11)) receiver = User.find(ActiveRecord::FixtureSet.identify(:senpai)) - NotificationMailer.with(report: report, receiver: receiver).trainee_report + NotificationMailer.with(report:, receiver:).trainee_report end def chose_correct_answer answer = Answer.find(ActiveRecord::FixtureSet.identify(:correct_answer2)) receiver = answer.sender - NotificationMailer.with(answer: answer, receiver: receiver).chose_correct_answer + NotificationMailer.with(answer:, receiver:).chose_correct_answer end def graduated sender = User.find(ActiveRecord::FixtureSet.identify(:sotugyou)) receiver = User.find(ActiveRecord::FixtureSet.identify(:mentormentaro)) - NotificationMailer.with(sender: sender, receiver: receiver).graduated + NotificationMailer.with(sender:, receiver:).graduated end def product_update product = Product.find(ActiveRecord::FixtureSet.identify(:product1)) receiver = User.find(ActiveRecord::FixtureSet.identify(:komagata)) - NotificationMailer.with(product: product, receiver: receiver).product_update + NotificationMailer.with(product:, receiver:).product_update end end diff --git a/test/models/answer_test.rb b/test/models/answer_test.rb index f9ce9acdcec..f6a36035f45 100644 --- a/test/models/answer_test.rb +++ b/test/models/answer_test.rb @@ -17,7 +17,7 @@ class AnswerTest < ActiveSupport::TestCase answer = Answer.create!( description: '最後の回答', user: answerer, - question: question, + question:, created_at: '2022-10-31', updated_at: '2022-10-31' ) diff --git a/test/models/bookmark_test.rb b/test/models/bookmark_test.rb index 516685c496c..9151ea63562 100644 --- a/test/models/bookmark_test.rb +++ b/test/models/bookmark_test.rb @@ -7,39 +7,39 @@ class BookmarkTest < ActiveSupport::TestCase user = users(:machida) report = reports(:report1) - Bookmark.create(user: user, bookmarkable: report) - assert_not Bookmark.new(user: user, bookmarkable: report).valid? + Bookmark.create(user:, bookmarkable: report) + assert_not Bookmark.new(user:, bookmarkable: report).valid? end test 'prohibit to duplicate question registration' do user = users(:kimura) question = questions(:question1) - Bookmark.create(user: user, bookmarkable: question) - assert_not Bookmark.new(user: user, bookmarkable: question).valid? + Bookmark.create(user:, bookmarkable: question) + assert_not Bookmark.new(user:, bookmarkable: question).valid? end test 'prohibit to duplicate product registration' do user = users(:kimura) product = products(:product1) - Bookmark.create(user: user, bookmarkable: product) - assert_not Bookmark.new(user: user, bookmarkable: product).valid? + Bookmark.create(user:, bookmarkable: product) + assert_not Bookmark.new(user:, bookmarkable: product).valid? end test 'prohibit to duplicate page registration' do user = users(:kimura) page = pages(:page1) - Bookmark.create(user: user, bookmarkable: page) - assert_not Bookmark.new(user: user, bookmarkable: page).valid? + Bookmark.create(user:, bookmarkable: page) + assert_not Bookmark.new(user:, bookmarkable: page).valid? end test 'prohibit to duplicate talk registration' do user = users(:komagata) talk = talks(:talk1) - Bookmark.create(user: user, bookmarkable: talk) - assert_not Bookmark.new(user: user, bookmarkable: talk).valid? + Bookmark.create(user:, bookmarkable: talk) + assert_not Bookmark.new(user:, bookmarkable: talk).valid? end end diff --git a/test/models/category_test.rb b/test/models/category_test.rb index a8c6feaed7a..eebd35d1814 100644 --- a/test/models/category_test.rb +++ b/test/models/category_test.rb @@ -8,6 +8,6 @@ class CategoryTest < ActiveSupport::TestCase course = courses(:course1) category = categories(:category2) - assert_equal category, Category.category(practice: practice, course: course) + assert_equal category, Category.category(practice:, course:) end end diff --git a/test/models/discord/times_channel_test.rb b/test/models/discord/times_channel_test.rb index 735e156d5c8..b15fa4e88d8 100644 --- a/test/models/discord/times_channel_test.rb +++ b/test/models/discord/times_channel_test.rb @@ -8,7 +8,7 @@ class TimesChannelTest < ActiveSupport::TestCase @stub_create_text_channel = lambda { |name:, parent:| Discordrb::Channel.new({ id: '1234567890', - name: name, + name:, parent_id: parent }.stringify_keys, nil) } diff --git a/test/models/event_test.rb b/test/models/event_test.rb index 47e0e318621..403779bbb13 100644 --- a/test/models/event_test.rb +++ b/test/models/event_test.rb @@ -68,7 +68,7 @@ class EventTest < ActiveSupport::TestCase event = events(:event3) user = users(:hatsuno) event.send_notification(user) - assert Notification.where(user: user, sender: event.user, link: "/events/#{event.id}").exists? + assert Notification.where(user:, sender: event.user, link: "/events/#{event.id}").exists? end test '#holding_today?' do From 4f18d7995c327621782a5484aa035c5a1d2be667 Mon Sep 17 00:00:00 2001 From: masyuko0222 Date: Tue, 20 Feb 2024 19:44:38 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=A0=E3=81=91=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=9F=E3=81=AE?= =?UTF-8?q?=E3=81=A7=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop_todo.yml | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 .rubocop_todo.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml deleted file mode 100644 index 2f751e026e3..00000000000 --- a/.rubocop_todo.yml +++ /dev/null @@ -1,13 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1000` -# on 2023-07-02 06:34:03 UTC using RuboCop version 1.37.1. -# The point is for the user to remove these configuration records -# one by one as the offenses are removed from the code base. -# Note that changes in the inspected code, or installation of new -# versions of RuboCop, may require this file to be generated again. - -# Offense count: 386 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. -# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys -# SupportedShorthandSyntax: always, never, either, consistent From 3ad31456d8432a75589366f9718c94bc492687e7 Mon Sep 17 00:00:00 2001 From: masyuko0222 Date: Tue, 20 Feb 2024 20:30:05 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E5=89=8A=E9=99=A4=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92rubocop.yml?= =?UTF-8?q?=E3=81=8B=E3=82=89=E3=82=82=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 04b6c5d4cd8..733b5bf4e19 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,8 +2,6 @@ require: - rubocop-minitest - rubocop-capybara -inherit_from: .rubocop_todo.yml - inherit_gem: rubocop-fjord: - config/rubocop.yml