Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # test
- require 'test_helper'
- class SiteLayoutTest < ActionDispatch::IntegrationTest
- test "layout links" do
- get root_path
- assert_template 'static_pages/home'
- assert_select "a[href=?]", root_path, count: 2
- assert_select "a[href=?]", help_path
- assert_select "a[href=?]", about_path
- aassert_select "a[href=?]", contact_path
- end
- end
- #futer
- <footer class="footer">
- <small>
- The <a href="http://www.railstutorial.org/">Ruby on Rails Tutorial</a>
- by <a href="http://www.michaelhartl.com/"> Michael Hartl</a>
- </small>
- <nav>
- <ul>
- <li><% link_to "About", about_path %></li>
- <li><% link_to "Contact", contact_path %></li>
- <li><a href="http://news.railstutorial.org/">News</a></li>
- </ul>
- </nav>
- </footer>
- #header
- <header class="navbar navbar-fixed-top navbar-inverse">
- <div class="container">
- <%= link_to "sample app" , root_path, id: "logo" %>
- <nav>
- <ul class="navbar navbar-fixed-top navbar-inverse">
- <li><%= link_to "Home", root_path %></li>
- <li><%= link_to "Help", help_path %></li>
- <li><%= link_to "Log in", '#' %></li>
- </ul>
- </nav>
- </div>
- </header>
- #ruty
- Rails.application.routes.draw do
- root 'static_pages#home'
- get '/help', to: 'static_pages#help'
- get '/about', to: 'static_pages#about'
- get '/contact', to: 'static_pages#contact'
- end
- #static pages controller
- require 'test_helper'
- class StaticPagesControllerTest < ActionDispatch::IntegrationTest
- test "should get home" do
- get root_path
- assert_response :success
- assert_select "title", "Home | Ruby on Rails Tutorial Sample App"
- end
- test "should get help" do
- get help_path
- assert_response :success
- assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
- end
- test "should get about" do
- get about_path
- assert_response :success
- assert_select "title", "About | Ruby on Rails Tutorial Sample App"
- end
- test "should get contact" do
- get contact_path
- assert_response :success
- assert_select "title", "Contact | Ruby on Rails Tutorial Sample App"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement