Files
danbooru/test/test_helpers/reportbooru_helper.rb
evazion 4f543671a2 tests: move test/helpers to test/test_helpers.
The Rails convention is for test/helpers to be used for testing the view
helpers in app/helpers. We were using it to store certain utility
methods instead. Move these to test/test_helpers so that test/helpers
can be used for its intended purpose.
2018-01-14 16:11:15 -06:00

13 lines
663 B
Ruby

module ReportbooruHelper
def mock_popular_search_service!
Danbooru.config.stubs(:reportbooru_server).returns("http://localhost:3003")
stub_request(:get, "http://localhost:3003/hits/month?date=#{Date.today}").to_return(body: "kantai_collection 1000.0\ntouhou 500.0")
stub_request(:get, "http://localhost:3003/hits/day?date=#{Date.today}").to_return(body: "kantai_collection 1000.0\ntouhou 500.0")
end
def mock_missed_search_service!
Danbooru.config.stubs(:reportbooru_server).returns("http://localhost:3003")
stub_request(:get, "http://localhost:3003/missed_searches").to_return(body: "kantai_collection 1000.0\ntouhou 500.0")
end
end