search: fix order:custom metatag.

Fix order:custom not working. Also change order:custom to return no
posts under the following error conditions:

* {{order:custom}} (id metatag isn't present)
* {{id:42 order:custom}} (id metatag isn't a list)
* {{id:>42 order:custom}} (id metatag isn't a list)
* {{id:1,2 id:2,3 order:custom}} (id metatag is present twice)
This commit is contained in:
evazion
2020-04-23 21:14:38 -05:00
parent 009b5ad84c
commit 627f079e3f
2 changed files with 25 additions and 2 deletions

View File

@@ -809,6 +809,20 @@ class PostQueryBuilderTest < ActiveSupport::TestCase
assert_tag_match([post2, post1, post3], "order:comment_bumped_asc")
end
should "return posts for order:custom" do
p1 = create(:post)
p2 = create(:post)
p3 = create(:post)
as(create(:gold_user)) do
assert_tag_match([p2, p1, p3], "id:#{p2.id},#{p1.id},#{p3.id} order:custom")
assert_tag_match([], "id:#{p1.id} order:custom")
assert_tag_match([], "id:>0 order:custom")
assert_tag_match([], "id:1,2 id:2,3 order:custom")
assert_tag_match([], "order:custom")
end
end
should "return posts for a filesize search" do
post = create(:post, file_size: 1.megabyte)