diff --git a/app/views/explore/posts/missed_searches.html.erb b/app/views/explore/posts/missed_searches.html.erb index df5e730bd..171017b87 100644 --- a/app/views/explore/posts/missed_searches.html.erb +++ b/app/views/explore/posts/missed_searches.html.erb @@ -15,7 +15,7 @@ - <% @search_service.missed_search_rankings do |tags, count| %> + <% @search_service.missed_search_rankings.each do |tags, count| %> <%= link_to tags, posts_path(:tags => tags) %> diff --git a/app/views/explore/posts/searches.html.erb b/app/views/explore/posts/searches.html.erb index 18d02f8bf..fb9e3446e 100644 --- a/app/views/explore/posts/searches.html.erb +++ b/app/views/explore/posts/searches.html.erb @@ -13,7 +13,7 @@ - <% @search_service.post_search_rankings(@date) do |tags, count| %> + <% @search_service.post_search_rankings(@date).each do |tags, count| %> <%= link_to tags, posts_path(:tags => tags) %> <%= count.to_i %> diff --git a/test/functional/explore/posts_controller_test.rb b/test/functional/explore/posts_controller_test.rb index 5fd79d5e1..f553bc594 100644 --- a/test/functional/explore/posts_controller_test.rb +++ b/test/functional/explore/posts_controller_test.rb @@ -41,6 +41,7 @@ module Explore mock_post_search_rankings(Date.today, [["1girl", 100], ["original", 50]]) get searches_explore_posts_path assert_response :success + assert_select "tbody tr", count: 2 end end @@ -49,6 +50,7 @@ module Explore mock_missed_search_rankings([["1girl", 100], ["original", 50]]) get missed_searches_explore_posts_path assert_response :success + assert_select "tbody tr", count: 2 end end end diff --git a/test/test_helpers/reportbooru_helper.rb b/test/test_helpers/reportbooru_helper.rb index 051c33395..6a99dc5d4 100644 --- a/test/test_helpers/reportbooru_helper.rb +++ b/test/test_helpers/reportbooru_helper.rb @@ -13,7 +13,8 @@ module ReportbooruHelper def mock_missed_search_rankings(date = Date.today, rankings) Danbooru.config.stubs(:reportbooru_server).returns("http://localhost:1234") url = "http://localhost:1234/missed_searches" - mock_request(url, body: rankings.to_json) + data = rankings.map { _1.join(" ") }.join("\n") + mock_request(url, body: data) end def mock_post_view_rankings(date = Date.today, rankings)