Advertisement
Guest User

ror error

a guest
Jan 2nd, 2013
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. pages_controllers_spec.rb
  2. ___________________________
  3. require 'spec_helper'
  4.  
  5. describe PagesController do
  6. render_views
  7.  
  8. describe "GET 'home'" do
  9. it "should be successful" do
  10. get 'home'
  11. response.should be_success
  12. end
  13.  
  14. it "should have the right title" do
  15. get 'home'
  16. response.should have_selector("title",
  17. :content => "Ruby on Rails Tutorial Sample App | Home")
  18. end
  19. end
  20.  
  21. describe "GET 'contact'" do
  22. it "should be successful" do
  23. get 'contact'
  24. response.should be_success
  25. end
  26.  
  27. it "should have the right title" do
  28. get 'contact'
  29. response.should be_selector("title",
  30. :content => "Ruby on Rails Tutorial Sample App | Contact")
  31. end
  32. end
  33.  
  34. describe "GET 'about'" do
  35. it "should be successful" do
  36. get 'about'
  37. response.should be_success
  38. end
  39.  
  40. it "should have the right title" do
  41. get 'about'
  42. response.should have_selector("title",
  43. :content => "Ruby on Rails Tutorial Sample App | About")
  44. end
  45. end
  46. end
  47. ____________________
  48. application.html.erb
  49.  
  50. <!DOCTYPE html>
  51. <html>
  52. <head>
  53. <title>Ruby on Rails Tutorial Sample App | <%= @title %></title>
  54. <%= stylesheet_link_tag "application", :media => "all" %>
  55. <%= javascript_include_tag "application" %>
  56. <%= csrf_meta_tags %>
  57. </head>
  58. <body>
  59.  
  60. <%= yield %>
  61.  
  62. </body>
  63. </html>
  64. _____________________
  65. pages.controller.rb
  66.  
  67. class PagesController < ApplicationController
  68. def home
  69. @title = "Home"
  70. end
  71. def contact
  72. @title = "Contact"
  73. end
  74. def about
  75. @title = "About"
  76. end
  77. end
  78. ____________________
  79. about.html.erb
  80.  
  81. <!doctype html>
  82. <html lang="en">
  83. <head>
  84. <title>Ruby on Rails Tutorial Sample App | About</title>
  85. </head>
  86. <body>
  87. <h1>About Us</h1>
  88. <p>This is the about page for the <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> sample application.</p>
  89. </body>
  90. </html>
  91. ____________
  92. home.html.erb
  93.  
  94. <!doctype html>
  95. <html lang="en">
  96. <head>
  97. <title>Ruby on Rails Tutorial Sample App | Home</title>
  98. </head>
  99. <body>
  100. <h1>Home</h1>
  101. <p>This is the home page for the <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> sample application.</p>
  102. </body>
  103. </html>
  104. ____________________-
  105.  
  106. contact.html.erb
  107.  
  108. <!doctype html>
  109. <html lang="en">
  110. <head>
  111. <title>Ruby on Rails Tutorial Sample App | Contact</title>
  112. </head>
  113. <body>
  114. <h1>Contact</h1>
  115. <p>This is the contact page for the <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a> sample application.
  116. </p>
  117. </body>
  118. </html>
  119.  
  120. ____________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement