Expected 0 to be >= 1.? Ruby On Rails Tutorial

rails

#1

Following along Hartl’s tutoria for Rails:

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

.
.
.

  1. Failure:
    StaticPagesControllerTest#test_should_get_home [/home/ubuntu/workspace/sample_app/test/controllers/static_pages_controller_test.rb:7]:
    Expected at least 1 element matching “Home”, found 0…
    Expected 0 to be >= 1.

This is the result of the [bundle exec rake test]… which is not supposed to happen according to Hartl’s tutorial.

By the way here is the html in between the title tags that we had to change in order to implement the full_title method of “erb”.

<%= full_title(yield(:title)) %>

This has come up a few times already, although I copied right off of the tutorial?
Is this on my part? And if it is? What does this mean and what can be done to prevent? Other explanations on the web are pretty vague about this…


#2

This test is loading your site and checking that the title is correct. I believe it’s failing because of the other issue you posted about here - Asset was not declared to be precompiled in production.? (img). Once you fix that issue so that your site loads correctly this test should pass.