Note that there are some explanatory texts on larger screens.

plurals
  1. POError with adding page in layout links portion of chapter 5 (Michael Hartl)
    primarykey
    data
    text
    <p>I am in section 5.3 in Michael Hartl's RoR tutorial, where I am adding a Contact Page. I ran <code>$ bundle exec rspec spec/requests/static_pages_spec.rb</code>. 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:</p> <pre><code>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') ... ^ # &lt;internal:prelude&gt;:10:in `synchronize' # ./spec/requests/static_pages_spec.rb:56:in `block (3 levels) in &lt;top (required)&gt;' 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') ... ^ # &lt;internal:prelude&gt;:10:in `synchronize' # ./spec/requests/static_pages_spec.rb:61:in `block (3 levels) in &lt;top (required)&gt;' 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' </code></pre> <p>In <code>static_pages_spec.rb</code>, I have following:</p> <pre><code> describe "Contact page" do it "should have the h1 'Contact'" do visit '/static_pages/contact' page.should have_selector('h1', :text =&gt; 'Contact') end it "should have the title 'Contact'" do visit '/static_pages/contact' page.should have_selector('title', :text =&gt; "Ruby on Rails Tutorial Happy App | Contact") end </code></pre> <p>In the RoR tutorial, this is what you are instructed to have in <code>static_pages_spec.rb</code>:</p> <pre><code> 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 </code></pre> <p>The only changes I made in <code>static_pages_spec.rb</code> 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 <code>static_pages_spec.rb</code>. When troubleshooting, I switched between both "text" versions and got the same result. </p> <p>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? </p> <p>Thank you!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload