search: refactor to pass in the current user explicitly.

This commit is contained in:
evazion
2022-09-22 04:16:28 -05:00
parent b56b6c554b
commit 88ac91f5f3
82 changed files with 233 additions and 280 deletions

View File

@@ -51,22 +51,9 @@ class BanTest < ActiveSupport::TestCase
context "Searching for a ban" do
should "find a given ban" do
CurrentUser.user = FactoryBot.create(:admin_user)
ban = create(:ban)
user = FactoryBot.create(:user)
ban = FactoryBot.create(:ban, user: user)
params = {
user_name: user.name,
banner_name: ban.banner.name,
reason: ban.reason,
expired: false,
order: :id_desc
}
bans = Ban.search(params)
assert_equal(1, bans.length)
assert_equal(ban.id, bans.first.id)
assert_search_equals(ban, user_name: ban.user.name, banner_name: ban.banner.name, reason: ban.reason, expired: false, order: :id_desc)
end
context "by user id" do