diff --git a/.rubocop.yml b/.rubocop.yml index f249c239..62544ad6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -73,3 +73,6 @@ Minitest/EmptyLineBeforeAssertionMethods: Enabled: false Minitest/MultipleAssertions: Enabled: false + +FactoryBot/ExcessiveCreateList: + Enabled: false diff --git a/app/controllers/admin/reviews_controller.rb b/app/controllers/admin/reviews_controller.rb index 11df96fb..61fba0e2 100644 --- a/app/controllers/admin/reviews_controller.rb +++ b/app/controllers/admin/reviews_controller.rb @@ -20,7 +20,7 @@ def index typed_params = TypedParams.extract!(IndexParams, params) page = typed_params.page - @reviews = Review.all.where(status: :pending).order(updated_at: :desc).page(page) + @reviews = Review.where(status: :pending).order(updated_at: :desc).page(page) end class ShowParams < T::Struct diff --git a/db/data/old rake tasks/backfill_instructor_registrar_listings.rake b/db/data/old rake tasks/backfill_instructor_registrar_listings.rake index 0e47abc5..3112e50d 100644 --- a/db/data/old rake tasks/backfill_instructor_registrar_listings.rake +++ b/db/data/old rake tasks/backfill_instructor_registrar_listings.rake @@ -14,7 +14,7 @@ namespace :data_migration do Searchkick.disable_callbacks - Section.all.find_each do |section| + Section.find_each do |section| Rails.logger.info("Section: #{section.id}, Section instructors: #{section.registrar_instructors}, Section instructor id: #{section.instructor_id}") if (section.registrar_instructors == ["No instructor"]) || (section.registrar_instructors == ["No instructors"]) || (section.registrar_instructors == ["The Staff"]) Rails.logger.info("Section has no instructor") @@ -45,7 +45,7 @@ namespace :data_migration do end end - orphaned_instructors = Instructor.all.where(registrar_listing: nil) + orphaned_instructors = Instructor.where(registrar_listing: nil) Rails.logger.info("Orphaned instructors: #{orphaned_instructors.size}, deleting") orphaned_instructors.destroy_all diff --git a/db/data/old rake tasks/backfill_subscribers_to_announcements_mailing_list.rake b/db/data/old rake tasks/backfill_subscribers_to_announcements_mailing_list.rake index d728c2b7..0ac0b4e8 100644 --- a/db/data/old rake tasks/backfill_subscribers_to_announcements_mailing_list.rake +++ b/db/data/old rake tasks/backfill_subscribers_to_announcements_mailing_list.rake @@ -13,7 +13,7 @@ namespace :data_migration do Rails.logger.level = :info ActiveRecord::Base.transaction do - User.all.find_each do |user| + User.find_each do |user| user.subscribe("announcements") unless user.subscribed?("announcements") user.save end diff --git a/lib/tasks/populate_instructors.rake b/lib/tasks/populate_instructors.rake index 84212f7f..1959d5e6 100644 --- a/lib/tasks/populate_instructors.rake +++ b/lib/tasks/populate_instructors.rake @@ -17,7 +17,7 @@ namespace :populate do end Rails.logger.info("Using term #{term.readable}") - SubjectArea.all.find_each do |subject_area| + SubjectArea.find_each do |subject_area| Rails.logger.info("Subject Area: #{subject_area.name}") sections = Section.joins(:instructor, :course).where("courses.subject_area_id": subject_area) Section.joins(:course).where(term:, "courses.subject_area_id": subject_area).find_each do |section| diff --git a/test/controllers/checkouts_controller_test.rb b/test/controllers/checkouts_controller_test.rb index c0194aa5..c5ea7504 100644 --- a/test/controllers/checkouts_controller_test.rb +++ b/test/controllers/checkouts_controller_test.rb @@ -23,7 +23,7 @@ class CheckoutsControllerTest < ActionDispatch::IntegrationTest "cancel_url" => "http://www.example.com/my-courses?session_id={CHECKOUT_SESSION_ID}", "customer" => "cus_9s6XBnVi5gbXub", "line_items" => [ - { "price" => ENV.fetch("NOTIFICATION_TOKENS_PRICE"), "quantity" => "1" }, + { "price" => ENV.fetch("NOTIFICATION_TOKENS_PRICE"), "quantity" => "1" }, ], "mode" => "payment", "payment_method_types" => ["card"], diff --git a/test/test_helpers/notification_helper.rb b/test/test_helpers/notification_helper.rb index 5b6a3381..314b8db4 100644 --- a/test/test_helpers/notification_helper.rb +++ b/test/test_helpers/notification_helper.rb @@ -5,9 +5,9 @@ module NotificationHelper extend T::Sig sig { params(notification_class: T.class_of(Noticed::Base), user: User, kwargs: T.anything).void } - def expect_notification_to_be_sent(notification_class, user, **kwargs) - notification = notification_class.with(**kwargs) - Mock.expects(notification_class, :with).with(**kwargs).returns(notification) + def expect_notification_to_be_sent(notification_class, user, **) + notification = notification_class.with(**) + Mock.expects(notification_class, :with).with(**).returns(notification) Mock.expects(notification, :deliver_later).with(user) end