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

@@ -5,23 +5,6 @@ class ApplicationRecordTest < ActiveSupport::TestCase
@tags = FactoryBot.create_list(:tag, 3, post_count: 1)
end
context "ApplicationRecord#search" do
should "support the id param" do
assert_equal([@tags.first], Tag.search(id: @tags.first.id))
end
should "support ranges in the id param" do
assert_equal(@tags.reverse, Tag.search(id: ">=1"))
assert_equal(@tags.reverse, Tag.search(id: "#{@tags[0].id}..#{@tags[2].id}"))
assert_equal(@tags.reverse, Tag.search(id: @tags.map(&:id).join(",")))
end
should "support the created_at and updated_at params" do
assert_equal(@tags.reverse, Tag.search(created_at: ">=#{@tags.first.created_at}"))
assert_equal(@tags.reverse, Tag.search(updated_at: ">=#{@tags.first.updated_at}"))
end
end
context "ApplicationRecord#parallel_each" do
context "in threaded mode" do
should "set CurrentUser correctly" do