Tuesday 25 June 2013

Michael Hartl tutorial Chapter 7. Error: " expected css "title" with text "Michael Hartl" to return something"

While passing the test for the show method of user, the test fail due to the following error.
Failures:

  1) User pages profile page
     Failure/Error: it { should have_selector('title', text: user.name) }
       expected css "title" with text "Michael Hartl" to return something
     # ./spec/requests/user_pages_spec.rb:18:in `block (3 levels) in <top (required)>'

Finished in 2.22 seconds
33 examples, 1 failure

Failed examples:

rspec ./spec/requests/user_pages_spec.rb:18 # User pages profile page
This is because of the helper tag in "app/views/users/show.html.erb"
 Replace
<% provide(:title, @user.name) %>
with 
 <title><%= @user.name%></title>

No comments:

Post a Comment