Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. # test
  2.  
  3. require 'test_helper'
  4.  
  5. class SiteLayoutTest < ActionDispatch::IntegrationTest
  6.  
  7. test "layout links" do
  8. get root_path
  9. assert_template 'static_pages/home'
  10. assert_select "a[href=?]", root_path, count: 2
  11. assert_select "a[href=?]", help_path
  12. assert_select "a[href=?]", about_path
  13. aassert_select "a[href=?]", contact_path
  14. end
  15. end
  16.  
  17. #futer
  18.  
  19. <footer class="footer">
  20. <small>
  21. The <a href="http://www.railstutorial.org/">Ruby on Rails Tutorial</a>
  22. by <a href="http://www.michaelhartl.com/"> Michael Hartl</a>
  23. </small>
  24. <nav>
  25. <ul>
  26. <li><% link_to "About", about_path %></li>
  27. <li><% link_to "Contact", contact_path %></li>
  28. <li><a href="http://news.railstutorial.org/">News</a></li>
  29. </ul>
  30. </nav>
  31. </footer>
  32.  
  33.  
  34. #header
  35.  
  36. <header class="navbar navbar-fixed-top navbar-inverse">
  37. <div class="container">
  38. <%= link_to "sample app" , root_path, id: "logo" %>
  39. <nav>
  40. <ul class="navbar navbar-fixed-top navbar-inverse">
  41. <li><%= link_to "Home", root_path %></li>
  42. <li><%= link_to "Help", help_path %></li>
  43. <li><%= link_to "Log in", '#' %></li>
  44. </ul>
  45. </nav>
  46. </div>
  47. </header>
  48.  
  49. #ruty
  50.  
  51. Rails.application.routes.draw do
  52. root 'static_pages#home'
  53. get '/help', to: 'static_pages#help'
  54. get '/about', to: 'static_pages#about'
  55. get '/contact', to: 'static_pages#contact'
  56. end
  57.  
  58. #static pages controller
  59.  
  60. require 'test_helper'
  61.  
  62. class StaticPagesControllerTest < ActionDispatch::IntegrationTest
  63.  
  64. test "should get home" do
  65. get root_path
  66. assert_response :success
  67. assert_select "title", "Home | Ruby on Rails Tutorial Sample App"
  68. end
  69.  
  70. test "should get help" do
  71. get help_path
  72. assert_response :success
  73. assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
  74. end
  75.  
  76. test "should get about" do
  77. get about_path
  78. assert_response :success
  79. assert_select "title", "About | Ruby on Rails Tutorial Sample App"
  80. end
  81.  
  82. test "should get contact" do
  83. get contact_path
  84. assert_response :success
  85. assert_select "title", "Contact | Ruby on Rails Tutorial Sample App"
  86. end
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement