Files
fizzy/test/controllers/concerns/block_search_engine_indexing_test.rb
T
Jeremy Daer b755b3fead Robots, begone (#1812)
* robots.txt: "Please, don't come in." If a page is directly linked, the
  URL can still appear in search results, though.
* X-Robots-Tag: "If you're here, forget what you saw." Works even if the
  crawler ignores robots.txt or reaches a page via external link. Can
  remove already-indexed pages.
* Public boards may not be indexed. They're meant for "anyone with the
  link" private sharing, not worldwide publishing.
2025-12-02 13:35:58 -08:00

29 lines
799 B
Ruby

require "test_helper"
class BlockSearchEngineIndexingTest < ActionDispatch::IntegrationTest
test "sets X-Robots-Tag header to none on authenticated requests" do
sign_in_as :david
get board_path(boards(:writebook))
assert_response :success
assert_equal "none", response.headers["X-Robots-Tag"]
end
test "sets X-Robots-Tag header to none on unauthenticated requests" do
untenanted do
get new_session_path
end
assert_response :success
assert_equal "none", response.headers["X-Robots-Tag"]
end
test "sets X-Robots-Tag header to none on public board pages" do
boards(:writebook).publish
get public_board_path(boards(:writebook).publication.key)
assert_response :success
assert_equal "none", response.headers["X-Robots-Tag"]
end
end