Files
danbooru/test/functional/static_controller_test.rb
evazion aa1a21aece Add OpenSearch support (/opensearch.xml).
Add https://danbooru.donmai.us/opensearch.xml. This file tells browsers
how to perform searches on Danbooru.

In Chrome, this lets you type "danb<tab>" in the address bar to perform
a search on Danbooru.

In Firefox, you have to click the "..." icon next to the address bar,
then choose "Add Search Engine". After that, you can search Danbooru
from the address bar.

Ref:

* http://dev.chromium.org/tab-to-search
* https://developer.mozilla.org/en-US/docs/Web/OpenSearch
* https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md
* https://en.wikipedia.org/wiki/OpenSearch
2020-07-04 17:52:49 -05:00

74 lines
1.5 KiB
Ruby

require "test_helper"
class StaticControllerTest < ActionDispatch::IntegrationTest
context "site_map action" do
should "work for anonymous users" do
get site_map_path
assert_response :success
end
should "work for admin users" do
get_auth site_map_path, create(:admin_user)
assert_response :success
end
end
context "sitemap action" do
should "work" do
create_list(:post, 3)
mock_post_search_rankings(Time.zone.yesterday, [["1girl", 100.0], ["2girls", 50.0]])
get sitemap_path, as: :xml
assert_response :success
end
end
context "dtext_help action" do
should "work" do
get dtext_help_path(format: :js), xhr: true
assert_response :success
end
end
context "terms_of_service action" do
should "work" do
get terms_of_service_path
assert_response :success
end
end
context "not_found action" do
should "work" do
get "/qwoiqogieqg"
assert_response 404
end
end
context "bookmarklet action" do
should "work" do
get bookmarklet_path
assert_response :success
end
end
context "contact action" do
should "work" do
get contact_path
assert_response :success
end
end
context "keyboard_shortcuts action" do
should "work" do
get keyboard_shortcuts_path
assert_response :success
end
end
context "opensearch action" do
should "work" do
get opensearch_path, as: :xml
assert_response :success
end
end
end