tests: add explore/posts controller tests.
This commit is contained in:
@@ -15,6 +15,27 @@ module Explore
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "#searches" do
|
||||
should "render" do
|
||||
get :searches
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "#missed_searches" do
|
||||
should "render" do
|
||||
get :missed_searches
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "#intro" do
|
||||
should "render" do
|
||||
get :intro
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
12
test/helpers/reportbooru_helper.rb
Normal file
12
test/helpers/reportbooru_helper.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
module ReportbooruHelper
|
||||
def mock_popular_search_service!
|
||||
Danbooru.config.stubs(:reportbooru_server).returns("http://localhost:3003")
|
||||
FakeWeb.register_uri(:get, "http://localhost:3003/hits/month?date=#{Date.today}", body: "kantai_collection 1000.0\ntouhou 500.0")
|
||||
FakeWeb.register_uri(:get, "http://localhost:3003/hits/day?date=#{Date.today}", body: "kantai_collection 1000.0\ntouhou 500.0")
|
||||
end
|
||||
|
||||
def mock_missed_search_service!
|
||||
Danbooru.config.stubs(:reportbooru_server).returns("http://localhost:3003")
|
||||
FakeWeb.register_uri(:get, "http://localhost:3003/missed_searches", body: "kantai_collection 1000.0\ntouhou 500.0")
|
||||
end
|
||||
end
|
||||
@@ -26,3 +26,13 @@ end
|
||||
|
||||
MEMCACHE = MemcacheMock.new
|
||||
Delayed::Worker.delay_jobs = false
|
||||
|
||||
require "helpers/reportbooru_helper"
|
||||
class ActiveSupport::TestCase
|
||||
include ReportbooruHelper
|
||||
|
||||
setup do
|
||||
mock_popular_search_service!
|
||||
mock_missed_search_service!
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user