Ruby on Rails Monday, November 2, 2015



On Sunday, November 1, 2015 at 8:15:53 PM UTC-6, James Harold wrote:

I have just gotten to Chapter Four of Michael Hartl's Ruby on Rails Tutorial, and I can't seem to get the program to work after adding a helper to the program. Here is the code from the files. 

static_pages_controller_test.rb
require 'test_helper'

class StaticPagesControllerTest < ActionController::TestCase
  test "should get home" do
    get :home
    assert_response :success
    assert_select "title", "Ruby on Rails Tutorial Sample App"
  end

  test "should get help" do
    get :help
    assert_response :success
    assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
  end

  test "should get about" do
    get :about
    assert_response :success
    assert_select "title", "About | Ruby on Rails Tutorial Sample App"
  end

  test "should get contact" do
    get :contact
    assert_response :success
    assert_select "title", "Contact | Ruby on Rails Tutorial Sample App"
  end
end


application.html.erb

<!DOCTYPE html>
<html>
  <head>
    <title><%= full_title(yield(:title)) %></title>
    <%= stylesheet_link_tag    'application', media: 'all',
                                              'data-turbolinks-track' => true %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
    <%= csrf_meta_tags %>
  </head>
  <body>
    <%= yield %>
  </body>
</html>


routes.rb
Rails.application.routes.draw do
  root 'static_pages#home'

  get 'static_pages/help'

  get 'static_pages/about'

  get 'static_pages/contact'

How do I get past this problem? Is there a way to fix this? 

BTW, the error is listed here: 

1) Failure:
StaticPagesControllerTest#test_should_get_about [C:/Sites/sample_app/test/controllers/static_pages_controller_test.rb:19]:
<About | Ruby on Rails Tutorial Sample App> expected but was
<About | Ruby on Rails Tutorial Sample App.>.
Expected 0 to be >= 1.


  2) Failure:
StaticPagesControllerTest#test_should_get_contact [C:/Sites/sample_app/test/controllers/static_pages_controller_test.rb:25]:
<Contact | Ruby on Rails Tutorial Sample App> expected but was
<Contact | Ruby on Rails Tutorial Sample App.>.
Expected 0 to be >= 1.


  3) Failure:
StaticPagesControllerTest#test_should_get_help [C:/Sites/sample_app/test/controllers/static_pages_controller_test.rb:13]:
<Help | Ruby on Rails Tutorial Sample App> expected but was
<Help | Ruby on Rails Tutorial Sample App.>.
Expected 0 to be >= 1.


  4) Failure:
StaticPagesControllerTest#test_should_get_home [C:/Sites/sample_app/test/controllers/static_pages_controller_test.rb:7]:
<Ruby on Rails Tutorial Sample App> expected but was
<Home | Ruby on Rails Tutorial Sample App.>.
Expected 0 to be >= 1.

 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/30850e77-fa6c-4f16-8fcb-bf0d21626a46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment