From a623ddf60fb2c33207226a2fb14d44729c2959ef Mon Sep 17 00:00:00 2001 From: naokinaokiboo Date: Mon, 22 Jan 2024 10:18:21 +0900 Subject: [PATCH 1/8] =?UTF-8?q?rubocop=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=81=A7?= =?UTF-8?q?Minitest/AssertIncludes=E3=82=92=E6=9C=89=E5=8A=B9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0fdc8d312b2..fe97c361b94 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -28,9 +28,6 @@ Metrics/ClassLength: - app/models/report.rb - app/notifiers/activity_notifier.rb -Minitest/AssertIncludes: - Enabled: false - Minitest/AssertEmpty: Enabled: false From 8a8db68c77be91addba993ed708e74b7403f7515 Mon Sep 17 00:00:00 2001 From: naokinaokiboo Date: Mon, 22 Jan 2024 14:04:44 +0900 Subject: [PATCH 2/8] =?UTF-8?q?rubocop=E3=81=AE=20Minitest/AssertIncludes?= =?UTF-8?q?=20=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B=E6=8C=87=E6=91=98?= =?UTF-8?q?=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/integration/api/products/unassigned_counts_test.rb | 2 +- test/models/regular_event_test.rb | 4 ++-- test/system/attachments_test.rb | 4 ++-- test/system/markdown_test.rb | 4 ++-- test/system/products_test.rb | 2 +- test/system/searchables_test.rb | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/integration/api/products/unassigned_counts_test.rb b/test/integration/api/products/unassigned_counts_test.rb index 61b50de8bac..03d52d6e2ae 100644 --- a/test/integration/api/products/unassigned_counts_test.rb +++ b/test/integration/api/products/unassigned_counts_test.rb @@ -21,6 +21,6 @@ class API::Products::UnassignedTextTest < ActionDispatch::IntegrationTest - 6日経過:2件 - 5日経過:1件 BODY - assert response.body.include?(expected) + assert_includes response.body, expected end end diff --git a/test/models/regular_event_test.rb b/test/models/regular_event_test.rb index f99016d7162..e48b0d28a50 100644 --- a/test/models/regular_event_test.rb +++ b/test/models/regular_event_test.rb @@ -152,8 +152,8 @@ class RegularEventTest < ActiveSupport::TestCase RegularEvent.remove_event([regular_events1, regular_events2], regular_event1.id) assert_not regular_events1.include?(regular_event1) - assert regular_events1.include?(regular_event2) - assert regular_events2.include?(regular_event3) + assert_includes regular_events1, regular_event2 + assert_includes regular_events2, regular_event3 end test '#assign_admin_as_organizer_if_none' do diff --git a/test/system/attachments_test.rb b/test/system/attachments_test.rb index 728d5247b6f..045472c3af6 100644 --- a/test/system/attachments_test.rb +++ b/test/system/attachments_test.rb @@ -6,12 +6,12 @@ class AttachmentsTest < ApplicationSystemTestCase test 'attachment user avatar' do visit_with_auth "/users/#{users(:komagata).id}", 'komagata' - assert find('img.user-profile__user-icon-image')['src'].include?('komagata.png') + assert_includes find('img.user-profile__user-icon-image')['src'], 'komagata.png' end test 'attachment company icons in reports' do report = reports(:report11) visit_with_auth "/reports/#{report.id}", 'kensyu' - assert find('img.page-content-header__company-logo')['src'].include?('2.png') + assert_includes find('img.page-content-header__company-logo')['src'], '2.png' end end diff --git a/test/system/markdown_test.rb b/test/system/markdown_test.rb index 847dc5d23be..13f549fef30 100644 --- a/test/system/markdown_test.rb +++ b/test/system/markdown_test.rb @@ -13,7 +13,7 @@ class MarkdownTest < ApplicationSystemTestCase assert_css '.a-long-text.is-md.js-markdown-view' assert_css '.speak' assert_css "a[href='/users/mentormentaro']" - assert find('.js-user-icon.a-user-emoji')['data-user'].include?('mentormentaro') + assert_includes find('.js-user-icon.a-user-emoji')['data-user'], 'mentormentaro' end test 'user profile image markdown test' do @@ -25,7 +25,7 @@ class MarkdownTest < ApplicationSystemTestCase assert_css '.a-long-text.is-md.js-markdown-view' assert_css "a[href='/users/mentormentaro']" - assert find('.js-user-icon.a-user-emoji')['data-user'].include?('mentormentaro') + assert_includes find('.js-user-icon.a-user-emoji')['data-user'], 'mentormentaro' end def cmd_ctrl diff --git a/test/system/products_test.rb b/test/system/products_test.rb index cdbe6f20a34..33267cf676b 100644 --- a/test/system/products_test.rb +++ b/test/system/products_test.rb @@ -569,7 +569,7 @@ class ProductsTest < ApplicationSystemTestCase - 6日経過:1件 - 5日経過:1件 BODY - assert page.body.include?(expected) + assert_includes page.body, expected end test 'no company trainee create product' do diff --git a/test/system/searchables_test.rb b/test/system/searchables_test.rb index c3ba62452e8..1b90de8a45b 100644 --- a/test/system/searchables_test.rb +++ b/test/system/searchables_test.rb @@ -175,7 +175,7 @@ class SearchablesTest < ApplicationSystemTestCase fill_in 'word', with: '提出物のコメントです。' end find('#test-search').click - assert find('img.card-list-item-meta__icon.a-user-icon')['src'].include?('komagata.png') + assert_includes find('img.card-list-item-meta__icon.a-user-icon')['src'], 'komagata.png' find('img.card-list-item-meta__icon.a-user-icon').click assert_selector 'h1.page-content-header__title', text: 'komagata' From 6c57d2d1dae7f06160328cfab80e053ea4963cae Mon Sep 17 00:00:00 2001 From: naokinaokiboo Date: Mon, 22 Jan 2024 14:06:30 +0900 Subject: [PATCH 3/8] =?UTF-8?q?rubocop=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=81=A7?= =?UTF-8?q?Minitest/AssertEmpty=E3=82=92=E6=9C=89=E5=8A=B9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index fe97c361b94..d35d2152053 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -28,9 +28,6 @@ Metrics/ClassLength: - app/models/report.rb - app/notifiers/activity_notifier.rb -Minitest/AssertEmpty: - Enabled: false - Minitest/AssertTruthy: Enabled: false From 32ba293c91ffdd494a84e9fcc95c1c4786616edb Mon Sep 17 00:00:00 2001 From: naokinaokiboo Date: Mon, 22 Jan 2024 14:42:13 +0900 Subject: [PATCH 4/8] =?UTF-8?q?rubocop=E3=81=AE=20Minitest/AssertEmpty=20?= =?UTF-8?q?=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B=E6=8C=87=E6=91=98=E3=81=AB?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/mailers/activity_mailer_test.rb | 40 ++++++++++++++-------------- test/models/user_test.rb | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/mailers/activity_mailer_test.rb b/test/mailers/activity_mailer_test.rb index 99b2087b587..6256aab619e 100644 --- a/test/mailers/activity_mailer_test.rb +++ b/test/mailers/activity_mailer_test.rb @@ -47,7 +47,7 @@ class ActivityMailerTest < ActionMailer::TestCase receiver: users(:hajime) ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries end test 'comebacked' do @@ -94,7 +94,7 @@ class ActivityMailerTest < ActionMailer::TestCase receiver: users(:hajime) ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries end test 'came_answer' do @@ -133,15 +133,15 @@ class ActivityMailerTest < ActionMailer::TestCase receiver.update_columns(mail_notification: false, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.came_answer(answer: answer.reload).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: false, retired_on: Date.current) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.came_answer(answer: answer.reload).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: true, retired_on: Date.current) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.came_answer(answer: answer.reload).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: true, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.came_answer(answer: answer.reload).deliver_now @@ -195,21 +195,21 @@ class ActivityMailerTest < ActionMailer::TestCase announcement: announce, receiver: receiver ).deliver_now - assert ActionMailer::Base.deliveries.empty? + 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 ).deliver_now - assert ActionMailer::Base.deliveries.empty? + 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 ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: true, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.post_announcement( @@ -310,21 +310,21 @@ class ActivityMailerTest < ActionMailer::TestCase mentionable: mentionable, receiver: mentioned.user ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries mentioned.user.update_columns(mail_notification: false, retired_on: Date.current) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.mentioned( mentionable: mentionable, receiver: mentioned.user ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries mentioned.user.update_columns(mail_notification: true, retired_on: Date.current) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.mentioned( mentionable: mentionable, receiver: mentioned.user ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries mentioned.user.update_columns(mail_notification: true, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.mentioned( @@ -378,7 +378,7 @@ class ActivityMailerTest < ActionMailer::TestCase receiver: users(:hajime) ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries end test 'checked' do @@ -427,7 +427,7 @@ class ActivityMailerTest < ActionMailer::TestCase check: check ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries end test 'create_page' do @@ -557,7 +557,7 @@ class ActivityMailerTest < ActionMailer::TestCase product: product ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries end test 'following_report' do @@ -675,21 +675,21 @@ class ActivityMailerTest < ActionMailer::TestCase product: product, receiver: receiver ).deliver_now - assert ActionMailer::Base.deliveries.empty? + 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 ).deliver_now - assert ActionMailer::Base.deliveries.empty? + 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 ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries receiver.update_columns(mail_notification: true, retired_on: nil) # rubocop:disable Rails/SkipsModelValidations ActivityMailer.assigned_as_checker( @@ -970,7 +970,7 @@ class ActivityMailerTest < ActionMailer::TestCase mailer.deliver_later end - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries end test 'not send chose_correct_answer email to retired user' do @@ -987,7 +987,7 @@ class ActivityMailerTest < ActionMailer::TestCase mailer.deliver_later end - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries end test 'no_correct_answer using synchronous mailer' do @@ -1112,6 +1112,6 @@ class ActivityMailerTest < ActionMailer::TestCase receiver: comment.receiver ).deliver_now - assert ActionMailer::Base.deliveries.empty? + assert_empty ActionMailer::Base.deliveries end end diff --git a/test/models/user_test.rb b/test/models/user_test.rb index ed25d443bec..e3d9eccb3ef 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -536,7 +536,7 @@ class UserTest < ActiveSupport::TestCase user.rename_avatar_and_strip_exif image = MiniMagick::Image.read(user.avatar.download) - assert image.exif.empty? + assert_empty image.exif assert user.avatar.filename, user.id user.avatar.purge From 19a0e055952c7eece13a86bbc4c92813004899bd Mon Sep 17 00:00:00 2001 From: naokinaokiboo Date: Mon, 22 Jan 2024 14:43:34 +0900 Subject: [PATCH 5/8] =?UTF-8?q?rubocop=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=81=A7?= =?UTF-8?q?Minitest/AssertTruthy=E3=82=92=E6=9C=89=E5=8A=B9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index d35d2152053..bc7dcac9c88 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -28,9 +28,6 @@ Metrics/ClassLength: - app/models/report.rb - app/notifiers/activity_notifier.rb -Minitest/AssertTruthy: - Enabled: false - Minitest/RefuteFalse: Enabled: false From 54e2ae33de492e11f6f9ade5a3dd15c0a606854d Mon Sep 17 00:00:00 2001 From: naokinaokiboo Date: Mon, 22 Jan 2024 15:54:46 +0900 Subject: [PATCH 6/8] =?UTF-8?q?rubocop=E3=81=AE=20Minitest/AssertTruthy=20?= =?UTF-8?q?=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B=E6=8C=87=E6=91=98=E3=81=AB?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/models/discord/times_channel_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/models/discord/times_channel_test.rb b/test/models/discord/times_channel_test.rb index 384308a7211..cedaa68200d 100644 --- a/test/models/discord/times_channel_test.rb +++ b/test/models/discord/times_channel_test.rb @@ -19,7 +19,7 @@ class TimesChannelTest < ActiveSupport::TestCase Discord::Server.stub(:create_text_channel, @stub_create_text_channel) do times_channel = Discord::TimesChannel.new('piyo') - assert_equal true, times_channel.save + assert times_channel.save assert_equal '1234567890', times_channel.id assert_equal '9876543210', times_channel.category_id end @@ -29,7 +29,7 @@ class TimesChannelTest < ActiveSupport::TestCase Discord::Server.stub(:create_text_channel, @stub_create_text_channel) do times_channel = Discord::TimesChannel.new('piyo') - assert_equal true, times_channel.save + assert times_channel.save assert_equal '1234567890', times_channel.id assert_nil times_channel.category_id end From 63e4e3a129018dd6f2ca77b04ba1dbdef049c694 Mon Sep 17 00:00:00 2001 From: naokinaokiboo Date: Mon, 22 Jan 2024 15:55:49 +0900 Subject: [PATCH 7/8] =?UTF-8?q?rubocop=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=81=A7?= =?UTF-8?q?Minitest/RefuteFalse=E3=82=92=E6=9C=89=E5=8A=B9=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index bc7dcac9c88..8b2d084092d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -28,9 +28,6 @@ Metrics/ClassLength: - app/models/report.rb - app/notifiers/activity_notifier.rb -Minitest/RefuteFalse: - Enabled: false - AllCops: Exclude: - '**/templates/**/*' From ab72a4d50d33719b90695c01f9f2b8a87fb14ee6 Mon Sep 17 00:00:00 2001 From: naokinaokiboo Date: Mon, 22 Jan 2024 16:10:19 +0900 Subject: [PATCH 8/8] =?UTF-8?q?rubocop=E3=81=AE=20Minitest/RefuteFalse=20?= =?UTF-8?q?=E3=81=AB=E9=96=A2=E3=81=99=E3=82=8B=E6=8C=87=E6=91=98=E3=81=AB?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/models/discord/times_channel_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/models/discord/times_channel_test.rb b/test/models/discord/times_channel_test.rb index cedaa68200d..735e156d5c8 100644 --- a/test/models/discord/times_channel_test.rb +++ b/test/models/discord/times_channel_test.rb @@ -40,7 +40,7 @@ class TimesChannelTest < ActiveSupport::TestCase Discord::Server.stub(:create_text_channel, ->(*) { nil }) do times_channel = Discord::TimesChannel.new('piyo') - assert_equal false, times_channel.save + assert_not times_channel.save assert_nil times_channel.id assert_nil times_channel.category_id end