site_layout_test.rb 508 B

123456789101112131415161718192021
  1. require 'test_helper'
  2. class SiteLayoutTest < ActionDispatch::IntegrationTest
  3. test "logged in layout links" do
  4. log_in_as users(:daniel)
  5. get home_path
  6. assert_template 'static_pages/home'
  7. assert_select "a[href=?]", root_path
  8. assert_select "a[href=?]", home_path
  9. assert_select "a[href=?]", about_path
  10. end
  11. test "logged out" do
  12. get home_path
  13. assert_redirected_to login_url
  14. follow_redirect!
  15. assert_template 'sessions/new'
  16. assert_select "nav", count: 0
  17. end
  18. end