Guest User

Untitled

a guest
Jan 17th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. rspec ./spec/requests/static_pages_spec.rb:39 #
  2. Static pages About page should have the title 'About Us'
  3.  
  4. class StaticPagesController < ApplicationController
  5. def home
  6. end
  7.  
  8. def help
  9. end
  10.  
  11. def about
  12. end
  13.  
  14. def Contact
  15. end
  16. end
  17.  
  18. <!DOCTYPE html>
  19. <html>
  20. <head>
  21. <title>Ruby on Rails Tutorial Sample App | About Us</title>
  22. </head>
  23. <body>
  24. <h1>About Us</h1>
  25.  
  26. describe "About page" do
  27.  
  28. it "should have the h1 'About Us'" do
  29. visit '/static_pages/about'
  30. page.should have_selector('h1', :text => 'About Us')
  31. end
  32. it "should have the title 'About Us'" do
  33. visit '/static_pages/about'
  34. page.should have_selector('title',
  35. :text => "Ruby on Rails Tutorial Sample App | About Us")
  36. end
  37. end
  38.  
  39. SampleApp::Application.routes.draw do
  40. get "static_pages/home"
  41.  
  42. get "static_pages/help"
  43.  
  44. get "static_pages/about"
  45.  
  46. get "static_pages/Contact"
  47. end
  48.  
  49. page.should have_xpath("//title", :text => "About Us")
Add Comment
Please, Sign In to add comment