I'm following Michael Hartl's "Ruby on Rails Tutorial: Learn Web Development", and creating the tests that check a user's name and email for validity of length (name as a maximum of 50 chars, email as 255 chars). The contents of test/helpers/application_helper_test.rb
are:
require 'test_helper'
class ApplicationHelperTest < ActionView::TestCase
test "full_title_helper" do
assert_equal full_title, FILL_IN
assert_equal full_title("Help"), FILL_IN
end
end
Upon running bundle exec rake test
, all tests pass, but I see the following message flagged as an error at the end:
ERROR["test_full_title_helper", ApplicationHelperTest, 1.820016791]
test_full_title_helper#ApplicationHelperTest (1.82s)
NameError: NameError: uninitialized constant ApplicationHelperTest::FILL_IN
test/helpers/application_helper_test.rb:5:in `block in <class:ApplicationHelperTest>'
test/helpers/application_helper_test.rb:5:in `block in <class:ApplicationHelperTest>'
Any ideas how to fix this?
Turns out the issue is FILL_IN isn't the literal title (obviously), so it needs to be replaced with "Help | Ruby on Rails Tutorial Sample App", and "Ruby on Rails Tutorial Sample App" respectively. -Thanks to Nick Veys and p11y for this answer.