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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:42:33+00:00 2026-06-16T17:42:33+00:00

I am in section 5.3 in Michael Hartl’s RoR tutorial, where I am adding

  • 0

I am in section 5.3 in Michael Hartl’s RoR tutorial, where I am adding a Contact Page. I ran $ bundle exec rspec spec/requests/static_pages_spec.rb. I cannot figure out the error. I made changes in spec/requests/static_pages_spec.rb, as well as added the appropriate route, action for the contact page and edited the view for the contact page. This is the output:

Failures:

  1) Static Pages Contact page should have the h1 'Contact'
 Failure/Error: visit '/static_pages/contact'
 ActionView::Template::Error:
   /Users/themaktravels/rails_projects/happy_app/app/views/static_pages/contact.html.erb:1: syntax error, unexpected ',', expecting ')'
   ...putBuffer.new; provide (:title, 'Contact') 
   ...                               ^
   /Users/themaktravels/rails_projects/happy_app/app/views/static_pages/contact.html.erb:1: syntax error, unexpected ')', expecting keyword_end
   ...ew; provide (:title, 'Contact') 
   ...                               ^
 # <internal:prelude>:10:in `synchronize'
 # ./spec/requests/static_pages_spec.rb:56:in `block (3 levels) in <top (required)>'

  2) Static Pages Contact page should have the title 'Contact'
 Failure/Error: visit '/static_pages/contact'
 ActionView::Template::Error:
   /Users/themaktravels/rails_projects/happy_app/app/views/static_pages/contact.html.erb:1: syntax error, unexpected ',', expecting ')'
   ...putBuffer.new; provide (:title, 'Contact') 
   ...                               ^
   /Users/themaktravels/rails_projects/happy_app/app/views/static_pages/contact.html.erb:1: syntax error, unexpected ')', expecting keyword_end
   ...ew; provide (:title, 'Contact') 
   ...                               ^
 # <internal:prelude>:10:in `synchronize'
 # ./spec/requests/static_pages_spec.rb:61:in `block (3 levels) in <top (required)>'

Finished in 0.53514 seconds
9 examples, 2 failures

Failed examples:

rspec ./spec/requests/static_pages_spec.rb:55 # Static Pages Contact page should have the h1 'Contact'
rspec ./spec/requests/static_pages_spec.rb:60 # Static Pages Contact page should have the title 'Contact'

In static_pages_spec.rb, I have following:

 describe "Contact page" do

     it "should have the h1 'Contact'" do
     visit '/static_pages/contact'
     page.should have_selector('h1', :text => 'Contact')
end

     it "should have the title 'Contact'" do
     visit '/static_pages/contact'
     page.should have_selector('title',
       :text => "Ruby on Rails Tutorial Happy App | Contact")
end

In the RoR tutorial, this is what you are instructed to have in static_pages_spec.rb:

 describe "Contact page" do

     it "should have the h1 'Contact'" do
     visit '/static_pages/contact'
     page.should have_selector('h1', text: 'Contact')
  end

     it "should have the title 'Contact'" do
     visit '/static_pages/contact'
     page.should have_selector('title',
                text: "Ruby on Rails Tutorial Sample App | Contact")
  end

The only changes I made in static_pages_spec.rb were (1) make “Sample App” to “Happy App” and (2) “text:” was used instead of “:text =>”, so that the format was consistent throughout the code in static_pages_spec.rb. When troubleshooting, I switched between both “text” versions and got the same result.

Any suggestions on what I should be looking for to solve the error? Also, I am unsure of how to read the error message, i.e. does the first section of the error show the proper method or vice versa?

Thank you!

  • 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-16T17:42:34+00:00Added an answer on June 16, 2026 at 5:42 pm

    It seems you have an unnecessary space on your provide line. It should be

    <% provide(:title, 'Contact') %>
    

    not

    <% provide (:title, 'Contact') %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In section 9.2.1 of Michael Hartl's new Rails Tutorial Book (3.2), there is a
This is from Michael Hartl's book, section 8.4. RSpec is testing a successful signup
In section 6.2.4 of Ruby on Rails 3 Tutorial , Michael Hartl describes a
I am following the Ruby on Rails tutorial by Michael Hartl. In section 6.3.1
I am currently following Michael Hartl's tutorial on RoR and am trying to get
I am completely new to ror and am following Michael Hartl's tutorial but I
Doing Michael Hartl's Rails Tutorial, on chapter 10, section 5, exercise 2 . I
While going through Ruby On Rails Tutorial by Michael Hartl,in the section where the
I am currently working through the Rails Tutorial by Michael Hartl and have run
I am following along with Michael Hartl's Ruby on Rails Tutorial 2nd Edition and

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.