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

  • Home
  • SEARCH
  • 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 4626324
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:24:12+00:00 2026-05-22T03:24:12+00:00

Currently doing the Ruby On Rails Tutorial by Michael Hartl, and am starting on

  • 0

Currently doing the Ruby On Rails Tutorial by Michael Hartl, and am starting on test-driven development. The tutorial demands that tests be written to ensure that the right titles are present on our html.erb pages. There are three of these pages – home, contact and about. The tests look like so:

it "should have the right title" do
  get 'home' 
  response.should have_tag("title",
                         "Ruby On Rails Sample Application | Home")
end

My home.html.erb file looks like so:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Ruby On Rails Sample Application | Home</title>
</head>
<body>
<h1>Sample App Home</h1>
<p>This is the home page for the 
<a href="http://www.railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.</p>
</body>
</html>

As you can see, the title tag is present and it’s wrapping the correct text. However, when I run my test, I get this error message:

'PagesController GET 'home' should have the right title' FAILED
 Expected at least 1 element matching "title", found 0.

Can anyone explain what is going wrong here? Thanks

  • 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-05-22T03:24:12+00:00Added an answer on May 22, 2026 at 3:24 am

    Do you have
    require 'spec_helper'
    on top of your pages_controller_spec.rb?

    Do you have
    render_views
    statement in your describe block?

    To John Paul Ashenfelter, I thought save_and_open_page was Capybara method, and not Rspec?

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

Sidebar

Related Questions

I'm working on a ruby on rails project currently, doing it without scaffolding or
Currently I'm doing some unit tests which are executed from bash. Unit tests are
I have a ruby on rails app that has a signup page. Different pages
I am currently implementing a blog-like site using Ruby on Rails. Each Post has
I'm still new to Ruby on Rails and I'm currently having a issue with
I am currently writing a quick script in Ruby that goes through all the
I've currently written an algorithm in Ruby based on the arc90 readability code to
I am currently consuming an api feed into a ruby on rails project. Being
I am fairly new to Ruby On Rails and right now I am doing
I'm brand new to Ruby/Rails/RSpec, and hopefully this is a dumb/simple question. I'm currently

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.