eBooru/test/unit/maintenance_test.rb

25 lines
659 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require "test_helper"
class MaintenanceTest < ActiveSupport::TestCase
context "daily maintenance" do
should "work" do
assert_nothing_raised { Maintenance.daily }
end
2018-08-24 17:49:34 -04:00
context "when pruning bans" do
should "clear the is_banned flag for users who are no longer banned" do
banner = create(:admin_user)
user = create(:user)
2018-08-24 17:49:34 -04:00
as(banner) { create(:ban, user: user, banner: banner, duration: 1) }
2018-08-24 17:49:34 -04:00
assert_equal(true, user.reload.is_banned)
travel_to(2.days.from_now) { Maintenance.daily }
2018-08-24 17:49:34 -04:00
assert_equal(false, user.reload.is_banned)
end
end
end
end