posts: fix error on post index page when search count times out in safe mode

Fix a nil deference error on the post index page. This happened when
performing a single tag search in safe mode and calculating the number
of search results timed out.
This commit is contained in:
evazion
2022-05-02 22:03:33 -05:00
parent 8d9e53da2b
commit 1a89071f2d
3 changed files with 11 additions and 1 deletions

View File

@@ -234,6 +234,13 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
assert_response 410
assert_select "h1", "Search Error"
end
should "render if the search count times out" do
PostQuery.any_instance.stubs(:exact_count).returns(nil)
get posts_path, params: { tags: "1girl", safe_mode: "true" }
assert_response :success
end
end
context "with a pool: search" do