reports: fix error when report is empty.

Fix an exception when a report is empty, for example when performing a
tag search that returns no results:

* https://betabooru.donmai.us/reports/posts?search[group]=uploader&search[tags]=does_not_exist
This commit is contained in:
evazion
2022-10-23 21:48:48 -05:00
parent 5565c753d0
commit 0d835983ce
5 changed files with 22 additions and 4 deletions

View File

@@ -26,6 +26,18 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
assert_response :success
end
should "work with the period and group params" do
get report_path("posts", search: { period: "month", group: "uploader" })
assert_response :success
end
should "work with the group param when the dataset is empty" do
get report_path("posts", search: { tags: "does_not_exist", group: "uploader" })
assert_response :success
end
should "work when filtering by a nested association" do
get report_path("posts", search: { uploader: { name: @post.uploader.name }})