1 require 'integration_helper'
4 class SmokeTest < ActionDispatch::IntegrationTest
5 def assert_visit_success(allowed=[200])
6 assert_includes(allowed, status_code,
7 "#{current_url} returned #{status_code}, not one of " +
11 def all_links_in(find_spec, text_regexp=//)
12 find(find_spec).all('a').collect { |tag|
13 if tag[:href].nil? or tag[:href].empty? or (tag.text !~ text_regexp)
17 url.host.nil? ? url.path : nil
22 test "all first-level links succeed" do
23 visit page_with_token('active_trustedclient', '/')
25 click_link 'user-menu'
26 urls = [all_links_in('nav'),
27 all_links_in('.navbar', /^Manage /)].flatten
29 while not (url = urls.shift).nil?
30 next if seen_urls.include? url
34 # Uncommenting the line below lets you crawl the entire site for a
36 # urls += all_links_in('body')