1 require 'integration_helper'
4 class SmokeTest < ActionDispatch::IntegrationTest
9 def assert_visit_success(allowed=[200])
10 assert_includes(allowed, status_code,
11 "#{current_url} returned #{status_code}, not one of " +
15 def all_links_in(find_spec, text_regexp=//)
16 all(find_spec + ' a').collect { |tag|
17 if tag[:href].nil? or tag[:href].empty? or (tag.text !~ text_regexp)
19 elsif tag[:'data-remote']
20 # these don't necessarily work with format=html
24 url.host.nil? ? url.path : nil
29 test "all first-level links succeed" do
30 visit page_with_token('active_trustedclient', '/')
32 click_link 'notifications-menu'
33 urls = [all_links_in('nav'),
34 all_links_in('.navbar', /^Manage /)].flatten
36 while not (url = urls.shift).nil?
37 next if seen_urls.include? url
41 # Uncommenting the line below lets you crawl the entire site for a
43 # urls += all_links_in('body')