Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9013253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:12:55+00:00 2026-06-16T03:12:55+00:00

I’ve been scouring the web & Stack Overflow to tr and figure out how

  • 0

I’ve been scouring the web & Stack Overflow to tr and figure out how to get these tests working. I’m brand new to Ruby & to Rails, I’m simply following along Hartl’s tutorial – copy pasting most of the code to see how it all falls together in the end.

Now, I’m getting stuck in section 3.3 “Slightly Dynamic Pages”.

This is the error I’m recieving:

C:\Sites\sample_app>bundle exec rspec --no-color spec/requests/static_pages_spec.rb
F.F.F.

Failures:

  1) Static pages About page should have the title 'About Us'
 Failure/Error: page.should have_selector('title',
   expected css "title" with text "Ruby on Rails Tutorial Sample App | About Us" to return something
 # ./spec/requests/static_pages_spec.rb:44:in `block (3 levels) in <top (required)>'

  2) Static pages Help page should have the title 'Help'
 Failure/Error: page.should have_selector('title',
   expected css "title" with text "Ruby on Rails Tutorial Sample App | Help" to return something
 # ./spec/requests/static_pages_spec.rb:29:in `block (3 levels) in <top (required)>'

  3) Static pages Home page should have the title 'Home'
 Failure/Error: page.should have_selector('title',
   expected css "title" with text "Ruby on Rails Tutorial Sample App | Home" to return something
 # ./spec/requests/static_pages_spec.rb:14:in `block (3 levels) in <top (required)>'

Finished in 3.09 seconds
6 examples, 3 failures

Failed examples:

rspec ./spec/requests/static_pages_spec.rb:42 # Static pages About page should have the title 'About Us'
rspec ./spec/requests/static_pages_spec.rb:27 # Static pages Help page should have the title 'Help'
rspec ./spec/requests/static_pages_spec.rb:12 # Static pages Home page should have the title 'Home'

Randomized with seed 25648

The error is occuring as soon as I swtich from this HTML Structure (in my About/Home/Help.html.erb files):

<% provide(:title, 'Home') %>
<!DOCTYPE html>
<html>
  <head>
    <title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
  </head>
  <body>
  <h1>Sample App</h1>
    <p>
      This is the home page for the
      <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
      sample application.
    </p>
</body>
</html>

To this:

<% provide(:title, 'Home') %>
<h1>Sample App</h1>
  <p>
     This is the home page for the
     <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
     sample application.
  </p>

Other related files:

Application.html.erb:

<!DOCTYPE html>
<html>
  <head>
    <title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
    <%= stylesheet_link_tag    "application", :media => "all" %>
    <%= javascript_include_tag "application" %>
    <%= csrf_meta_tags %>
  </head>
  <body>
    <%= yield %>
  </body>
</html>

static_pages_spec.rb

require 'spec_helper'

describe "Static pages" do


describe "Home page" do
  it "should have the h1 'Sample App'" do
    visit '/static_pages/home'
    page.should have_selector('h1', :text => 'Sample App')
  end

  it "should have the title 'Home'" do
    visit '/static_pages/home'
    page.should have_selector('title',
                    :text => "Ruby on Rails Tutorial Sample App | Home")

     // The line below is something I tried replacing the page.should have_selector with
    // page.should have_xpath("//title", :text => "Home")
  end
end

.... (other describe pages, same structure)

end

I might’ve just gone blind over the course of copying/pasting/reading from Hartl’s tutorial, but I am pretty damn sure it looks the same way as he described it.

I’ve done my best at looking for a solution to this, but alas I haven’t been able to figure it out, so here goes!

Cheers!

Edit: Answer to Fiona #1

On this url : “http://localhost:3000/static_pages/home&#8221;

The document title is nothing.

The source of the document looks like this:

<h1>Sample App</h1>
<p>
  This is the home page for the
  <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
  sample application.
</p>

There is no doctype, head, body or title declaration in the source.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:12:56+00:00Added an answer on June 16, 2026 at 3:12 am

    For Rails to pick up the layout file, the application.html.erb file should be in app/views/layouts/application.html.erb.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want use html5's new tag to play a wav file (currently only supported
I'm interested in microtypography issues on the web. I want a tool to fix:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.