Topic: I have problem linking my application.html.erb to my home.html.erb

i have problem trying to get my home static page to work
the test unit give error when i tried to test for the "title" of my page.
the code in the "application.html.erb" goes like this

<!DOCTYPE html>
<html>
<head>
  <title>Users Interactive | <%= yield(:title) %></title>
  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>

the home page goes like this:

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

<h1>Sample App</h1>
<p>
  This is my sample home page
</p>

the spec test goes like this:

it "should have the title 'Help'" do
             visit '/static_pages/help'
             page.should have_selector('title',
                               :text => "Users Interactve | Home")
           end

it give a failing report as:

Failures:

  1) Static pages Home page should have the title 'Home'
     Failure/Error: page.should have_selector('title',
       expected css "title" with text "Users Interactive | Home" to return something
     # ./spec/requests/static_pages_spec.rb:15:in `block (3 levels) in <top (required)>'

Finished in 0.30253 seconds
6 examples, 1 failure

ANY SUGGESTION PLEASE

Last edited by dimonge (2012-03-19 07:04:40)

Re: I have problem linking my application.html.erb to my home.html.erb

Am using Rails 3.2.2