Files
simple-aircraft-manager-rails/test/integration/user_guide_test.rb
T
rickyandClaude Opus 5.5 e939d29deb 2026.11.2: disclaimer (no warranty; verifying legal use is up to the user)
- docs/guide/disclaimer.md, shown as Help -> Disclaimer: provided as is, not
  FAA-approved, user verifies legal and suitable use (43.9/43.11/91.417,
  AC 120-78B), status and AD matches don't replace the records or the PIC's
  decision, no liability, host responsible for the instance
- README: notice at the top and a Disclaimer section
- Footer notice on every page (app and public layouts), notice on first-run
  setup, link from Admin -> About and the guide's start page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 18:11:20 -05:00

53 lines
1.9 KiB
Ruby

require "test_helper"
# The user guide in docs/guide, shown under /help.
class UserGuideTest < ActionDispatch::IntegrationTest
setup { sign_in create_user("pilot@example.com") }
test "every guide page renders with the contents and links between pages" do
get help_path
assert_response :success
assert_select "h1", "User guide"
HelpGuide::ORDER.each do |slug|
assert HelpGuide.find(slug), "docs/guide/#{slug}.md is missing"
get(slug == "README" ? help_path : help_page_path(slug))
assert_response :success
assert_select "nav[aria-label='Help pages'] a", HelpGuide::ORDER.size * 2
assert_no_match(/href="[a-z-]+\.md/, response.body, "#{slug} has an unconverted .md link")
end
get help_page_path("logbook")
assert_select "a[href='/help/records#mistakes']"
end
test "links in the guide point at real pages and headings" do
HelpGuide.pages.each do |page|
page.markdown.scan(/\]\(([a-z-]+|README)\.md(?:#([a-z0-9-]+))?\)/).each do |slug, anchor|
target = HelpGuide.find(slug)
assert target, "#{page.slug} links to missing #{slug}.md"
assert_includes HelpGuide.html(target, link: nil), %(id="#{anchor}"), "#{page.slug} links to missing ##{anchor} in #{slug}" if anchor
end
end
end
test "the disclaimer says verifying legal use is up to the user, and every page links to it" do
get help_page_path("disclaimer")
assert_response :success
assert_includes response.body, "up to you to verify"
get root_path
assert_select "footer a[href='#{help_page_path("disclaimer")}']", "Disclaimer"
end
test "only guide pages can be opened" do
get "/help/secrets"
assert_response :not_found
get records_help_path
assert_response :success
assert_includes response.body, "Correct this entry"
end
test "the guide is in the menu" do
get root_path
assert_select "a[href='/help']", minimum: 1
end
end