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 6708847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:48:33+00:00 2026-05-26T07:48:33+00:00

I’m trying to follow the ruby on rails tutorial and impliment the Integration Testing.

  • 0

I’m trying to follow the ruby on rails tutorial and impliment the Integration Testing.

I first run the command: bundle exec rspec spec/

And it tells me all but one of my sixteen tests passes. Here is the part where I think the issue is:

 require 'spec_helper'
 describe "LayoutLinks" do

   it "should have the right links on the layout" do
    visit root_path
    click_link "Help"
    response.should have_selector('title', :content => "Help")
    click_link "Contact"
    response.should have_selector('title', :content => "Contact")
    click_link "Home"
    response.should have_selector('title', :content => "Home")
    click_link "Sign up now!"
    response.should have_selector('title', :content => "Sign Up")
    click_link "About"
    response.should have_selector('title', :content => "About")
  end
end

As a result I get the following:

Failure/Error: response.should have_selector('title', :content => "Help")
   expected following output to contain a <title>Help</title> tag:
#home.html.erb page's source shown
<!DOCTYPE html>
   <html>
   <head>
   <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
   <title>Ruby on Rails Tutorial Sample App | Home</title> 
   #The line above is why the test fails. 
   #It is loading home.html.erb instead of help.html.erb
   .
   .
   .
   # ./spec/requests/layout_links_spec.rb:34:in `block (2 levels) in <top (required)>'

I can move around the order of the tests and it is always the top test that fails. This makes me believe there is something wrong here and not with the actual rails code. I can also go to the demo website and the links work and they go to the correct pages. I have looked at the other issues other people have had with this and I can’t seem to find anyone who is having the same issues. How can I go about trouble shooting this?

Update:

noahc:sample_app noahc$ rake routes
users_new GET /users/new(.:format)     {:controller=>"users", :action=>"new"}
   signup     /signup(.:format)        {:controller=>"users", :action=>"new"}
  contact     /contact(.:format)       {:controller=>"pages", :action=>"contact"}
    about     /about(.:format)         {:controller=>"pages", :action=>"about"}
     help     /help(.:format)          {:controller=>"pages", :action=>"help"}
              /help(.:format)          {:controller=>"pages", :action=>"help"}
     root     /                        {:controller=>"pages", :action=>"home"}
pages_home GET /pages/home(.:format)    {:controller=>"pages", :action=>"home"}
pages_contact GET /pages/contact(.:format) {:controller=>"pages", :action=>"contact"}
pages_about GET /pages/about(.:format)   {:controller=>"pages", :action=>"about"}
pages_help GET /pages/help(.:format)    {:controller=>"pages", :action=>"help"}
  • 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-26T07:48:33+00:00Added an answer on May 26, 2026 at 7:48 am

    Noah, I would recommend splitting that test up into multiple tests, one for each title that you would like to test. That will make it a little easier for you to pinpoint exactly what’s wrong. Something like this:

    it "should have a link to 'Help'" do
      visit root_path
      response.should have_selector('a', :href => help_path, :content => "Help")
      click_link "Help"
      response.should have_selector('title', :content => 'Help')
    end
    
    it "should have a link to 'Contact'" do
      visit root_path
      response.should have_selector('a', :href => contact_path, :content => "Contact")
      click_link "Help"
      response.should have_selector('title', :content => 'Contact')
    end
    

    etc… This will make it easier to pinpoint exactly what is going on, and where you’re experiencing a problem. Also, what did it say was being displayed in the page’s source? You cut off the error message before it explained what really happened in your paste snippet… Look inside what the code that is actually being returned says to see what the title is and how/why it is differing from what rspec is expecting.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

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.