Fix #4455: Two tag search gives option to create wiki page when one is a metatag.

This commit is contained in:
evazion
2020-05-12 17:39:37 -05:00
parent ca00563a4d
commit ea400296d4
3 changed files with 26 additions and 11 deletions

View File

@@ -102,7 +102,7 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
context "with a multi-tag search" do
should "render" do
as(create(:user)) do
create(:post, tag_string: "1girl solo")
create(:post, tag_string: "1girl solo", rating: "s")
create(:wiki_page, title: "1girl")
end
@@ -111,6 +111,23 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
assert_select "#show-excerpt-link", count: 0
end
should "show the wiki excerpt if the search has a tag with a wiki" do
as(@user) { create(:wiki_page, title: "1girl") }
create(:post, tag_string: "1girl rating:s")
get posts_path, params: { tags: "1girl rating:s" }
assert_response :success
assert_select "li.wiki-excerpt-link", count: 1
end
should "show the blank wiki excerpt if the search has tag without a wiki" do
create(:post, tag_string: "1girl rating:s")
get posts_path, params: { tags: "1girl rating:s" }
assert_response :success
assert_select "li.blank-wiki-excerpt-link", count: 1
end
should "render an error when searching for too many tags" do
get posts_path, params: { tags: "1 2 3" }