diff --git a/app/logical/maintenance.rb b/app/logical/danbooru_maintenance.rb similarity index 97% rename from app/logical/maintenance.rb rename to app/logical/danbooru_maintenance.rb index 865a006b5..ed29be84b 100644 --- a/app/logical/maintenance.rb +++ b/app/logical/danbooru_maintenance.rb @@ -1,4 +1,4 @@ -module Maintenance +module DanbooruMaintenance module_function def hourly diff --git a/lib/tasks/maintenance.rake b/lib/tasks/maintenance.rake index 812103d4e..99e1936ae 100644 --- a/lib/tasks/maintenance.rake +++ b/lib/tasks/maintenance.rake @@ -3,16 +3,16 @@ require "tasks/newrelic" if defined?(NewRelic) namespace :maintenance do desc "Run hourly maintenance jobs" task hourly: :environment do - Maintenance.hourly + DanbooruMaintenance.hourly end desc "Run daily maintenance jobs" task daily: :environment do - Maintenance.daily + DanbooruMaintenance.daily end desc "Run weekly maintenance jobs" task weekly: :environment do - Maintenance.weekly + DanbooruMaintenance.weekly end end diff --git a/test/unit/maintenance_test.rb b/test/unit/danbooru_maintenance_test.rb similarity index 85% rename from test/unit/maintenance_test.rb rename to test/unit/danbooru_maintenance_test.rb index 745ca787e..c0190e7dd 100644 --- a/test/unit/maintenance_test.rb +++ b/test/unit/danbooru_maintenance_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class MaintenanceTest < ActiveSupport::TestCase +class DanbooruMaintenanceTest < ActiveSupport::TestCase context "daily maintenance" do setup do # have ApiCacheGenerator save files to a temp dir. @@ -17,14 +17,14 @@ class MaintenanceTest < ActiveSupport::TestCase end should "work" do - assert_nothing_raised { Maintenance.daily } + assert_nothing_raised { DanbooruMaintenance.daily } end should "prune expired posts" do @pending = FactoryBot.create(:post, is_pending: true, created_at: 4.days.ago) @flagged = FactoryBot.create(:post, is_flagged: true, created_at: 4.days.ago) - Maintenance.daily + DanbooruMaintenance.daily assert(true, @pending.reload.is_deleted) assert(true, @flagged.reload.is_deleted) @@ -38,7 +38,7 @@ class MaintenanceTest < ActiveSupport::TestCase CurrentUser.as(banner) { FactoryBot.create(:ban, user: user, banner: banner, duration: 1) } assert_equal(true, user.reload.is_banned) - travel_to(2.days.from_now) { Maintenance.daily } + travel_to(2.days.from_now) { DanbooruMaintenance.daily } assert_equal(false, user.reload.is_banned) end end