Files
danbooru/test/functional/explore/posts_controller_test.rb
evazion a4df18e650 Refactor Reportbooru API clients.
* Combine MissedSearchService, PostViewCountService, and
  PopularSearchService into single ReportbooruService class.
* Use Danbooru::Http for these services instead of HTTParty.
2020-06-14 00:32:42 -05:00

57 lines
1.4 KiB
Ruby

require "test_helper"
module Explore
class PostsControllerTest < ActionDispatch::IntegrationTest
context "in all cases" do
setup do
@post = create(:post)
end
context "#popular" do
should "render" do
get popular_explore_posts_path
assert_response :success
end
should "work with a blank date" do
get popular_explore_posts_path(date: "")
assert_response :success
end
end
context "#curated" do
should "render" do
@builder = create(:builder_user)
@post.add_favorite!(@builder)
get curated_explore_posts_path
assert_response :success
end
end
context "#viewed" do
should "render" do
mock_post_view_rankings(Date.today, [[@post.id, 100]])
get viewed_explore_posts_path
assert_response :success
end
end
context "#searches" do
should "render" do
mock_post_search_rankings(Date.today, [["1girl", 100], ["original", 50]])
get searches_explore_posts_path
assert_response :success
end
end
context "#missed_searches" do
should "render" do
mock_missed_search_rankings([["1girl", 100], ["original", 50]])
get missed_searches_explore_posts_path
assert_response :success
end
end
end
end
end