Note that there are some explanatory texts on larger screens.

plurals
  1. POexpected css "title" Hartl's Tutorial Chapter 5 Exercises
    primarykey
    data
    text
    <p>I am working through <a href="http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec-layout_exercises" rel="nofollow">Michael Hartl's Ruby on Rails Tutorial Chapter 5 exercises</a> and I keep getting a failing test that I cannot figure out.</p> <p>I'm working with the click_link problem and All the caps match and the I believe all the other files are correct. I'm really not sure what's wrong here. I've tried restarting Spork. And whenever I comment out the first click_link test, it pull up an error for the second one and so on... Feel free to take a look at the code at <a href="http://github.com/sambaek/sample_app" rel="nofollow">http://github.com/sambaek/sample_app</a>.</p> <p>Can someone help me out? Thanks a bunch!</p> <h2>spec/support/utilities.rb</h2> <pre><code>include ApplicationHelper </code></pre> <h2>spec/requests/static_pages_spec.rb</h2> <pre><code>require 'spec_helper' describe "Static pages" do subject { page } shared_examples_for "all static pages" do it { should have_selector('h1', text: heading) } it { should have_selector('title', text: full_title(page_title)) } end describe "Home page" do before { visit root_path } let(:heading) { 'Sample App' } let(:page_title) { '' } it_should_behave_like "all static pages" it { should_not have_selector 'title', text: '| Home' } end describe "Help page" do before { visit help_path } let(:heading) { 'Help' } let(:page_title) { 'Help' } it_should_behave_like "all static pages" end describe "About page" do before { visit about_path } let(:heading) { 'About Us' } let(:page_title) { 'About Us' } it_should_behave_like "all static pages" end describe "Contact page" do before { visit contact_path } let(:heading) { 'Contact' } let(:page_title) { 'Contact' } it_should_behave_like "all static pages" end it "should have the right links on the layout" do visit root_path click_link "About" page.should have_selector 'title', text: full_title('About Us') click_link "Help" page.should have_selector 'title', text: full_title('Help') click_link "Contact" page.should have_selector 'title', text: full_title('Contact') click_link "Home" click_link "Sign up now!" page.should have_selector 'title', text: full_title('Sign Up') click_link "sample app" page.should_not have_selector 'title', text: full_title(' | Home') end end </code></pre> <h2>spec/helpers/application_helper_spec.rb</h2> <pre><code>require 'spec_helper' describe ApplicationHelper do describe "full_title" do it "should include the page title" do full_title("foo").should =~ /foo/ end it "should include the base title" do full_title("foo").should =~ /^Ruby on Rails Tutorial Sample App/ end it "should not include a bar for the home page" do full_title("").should_not =~ /\|/ end end end </code></pre> <h2>app/helpers/application_helper.rb</h2> <pre><code>module ApplicationHelper def full_title(page_title) base_title = "Ruby on Rails Tutorial Sample App" if page_title.empty? base_title else "#{base_title} | #{page_title}" end end end </code></pre> <h2>Terminal Output</h2> <pre><code>rspec spec/ ..F............ Failures: 1) Static pages should have the right links on the layout Failure/Error: page.should have_selector 'title', text: full_title('About Us') expected css "title" with text "Ruby on Rails Tutorial Sample App | About Us" to return something # ./spec/requests/static_pages_spec.rb:52:in `block (2 levels) in &lt;top (required)&gt;' Finished in 4.37 seconds 15 examples, 1 failure Failed examples: rspec ./spec/requests/static_pages_spec.rb:49 # Static pages should have the right links on the layout </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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