0

Error: http://i.imgur.com/mZ87w.png

Code pasted at http://pastebin.com/mYSMupYy

I've been trying to fix this for awhile and can't see anything wrong.

Paul Fioravanti
  • 16,423
  • 7
  • 71
  • 122
  • It looks like you are loading the header information twice, you are loading it once in application.html and once in the specific file (about, contact, home) This might be causing the problem – GrayB Jan 02 '13 at 16:29
  • What version of RSpec are you using? See http://stackoverflow.com/questions/3517724/why-is-rspec-saying-failure-error-unable-to-find-matching-line-from-backtrace – PinnyM Jan 02 '13 at 16:30
  • 3
    Please post text, not links to images. – Dave Newton Jan 02 '13 at 16:45
  • sorry Dave, I'm new here :/ won't happen again – Jennifer Tanner Jan 02 '13 at 16:50
  • rspec-rails (2.12.0) and how could I fix that GrayB? – Jennifer Tanner Jan 02 '13 at 16:55
  • In home.html.erb, contact.html.erb & about.html.erb you want to just put what goes inside the body tag. The application.html.erb file is your template page, it so you don't have to rewrite the same information in each file. – GrayB Jan 02 '13 at 17:03
  • I still have the same error but thanks for the tip – Jennifer Tanner Jan 02 '13 at 17:07
  • Check this question: http://stackoverflow.com/questions/3971449/verifying-page-title-with-rspec – GrayB Jan 02 '13 at 17:12
  • if anyone can help me I will love you forever... I cannot find anything wrong with this to save my life – Jennifer Tanner Jan 02 '13 at 18:50
  • I can't reproduce your error. Could you be more specific about the error message? You might also try adding `puts response.body.inspect` above the failing line to dump the rendered page. – zetetic Jan 04 '13 at 04:12

2 Answers2

1

It looks like you are manually setting the titles in all of your .html.erb files instead of using the instance variables you have defined in your controller. Try doing this for each page.

home.html.erb

<!doctype html>
<html lang="en">
<head>
    <title>Ruby on Rails Tutorial Sample App | <%= @title %></title> <!-- changed 'Home' to @title -->
</head>
<body>
    <h1>Home</h1>
<p>This is the home page for the <a href="http://railstutorial.org/">Ruby on Rails     Tutorial</a> sample application.</p>
</body>
</html>
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
toolz
  • 63
  • 9
  • This is probably a more helpful answer than mine. :) Upvoted. – Jason Swett Jan 04 '13 at 16:55
  • You seem to be a veteran here. Any tips on why my formatting is crap? I just put 4 spaces in front of every line. Why is the stuff on the bottom red? – toolz Jan 04 '13 at 17:01
  • 1
    I'm not real sure. SO seems to have some kind of "one size fits all" syntax highlighter, so I would guess that the ERB code in the HTML is throwing it off. – Jason Swett Jan 04 '13 at 17:04
0

I'm guessing your pages don't have the right titles. If you go to the home page, and view the source, does it say "Ruby on Rails Tutorial Sample App | Home" between the <title> tags?

If not, you'll probably want to check app/views/layouts/application.html.erb and edit the title there. There might be a part in the tutorial about that that you missed.

Jason Swett
  • 43,526
  • 67
  • 220
  • 351