Merge pull request #3233 from evazion/feat-order-metatags

Add order:{tagcount,gentags,arttags,chartags,copytags} metatags.
This commit is contained in:
Albert Yi
2017-07-31 11:56:06 -07:00
committed by GitHub
3 changed files with 49 additions and 0 deletions

View File

@@ -2115,6 +2115,8 @@ class PostTest < ActiveSupport::TestCase
should "return posts ordered by a particular attribute" do
posts = (1..2).map do |n|
tags = ["tagme", "gentag1 gentag2 artist:arttag char:chartag copy:copytag"]
p = FactoryGirl.create(
:post,
score: n,
@@ -2123,6 +2125,7 @@ class PostTest < ActiveSupport::TestCase
# posts[0] is portrait, posts[1] is landscape. posts[1].mpixels > posts[0].mpixels.
image_height: 100*n*n,
image_width: 100*(3-n)*n,
tag_string: tags[n-1],
)
FactoryGirl.create(:artist_commentary, post: p)
@@ -2142,6 +2145,11 @@ class PostTest < ActiveSupport::TestCase
assert_tag_match(posts.reverse, "order:mpixels")
assert_tag_match(posts.reverse, "order:portrait")
assert_tag_match(posts.reverse, "order:filesize")
assert_tag_match(posts.reverse, "order:tagcount")
assert_tag_match(posts.reverse, "order:gentags")
assert_tag_match(posts.reverse, "order:arttags")
assert_tag_match(posts.reverse, "order:chartags")
assert_tag_match(posts.reverse, "order:copytags")
assert_tag_match(posts.reverse, "order:rank")
assert_tag_match(posts, "order:id_asc")
@@ -2155,6 +2163,11 @@ class PostTest < ActiveSupport::TestCase
assert_tag_match(posts, "order:mpixels_asc")
assert_tag_match(posts, "order:landscape")
assert_tag_match(posts, "order:filesize_asc")
assert_tag_match(posts, "order:tagcount_asc")
assert_tag_match(posts, "order:gentags_asc")
assert_tag_match(posts, "order:arttags_asc")
assert_tag_match(posts, "order:chartags_asc")
assert_tag_match(posts, "order:copytags_asc")
end
should "return posts for order:comment_bumped" do