ruby on rails - NameError: uninitialized constant ApplicationHelperTest::Fill_IN -
i error message when add last test in code ruby on rails tutorial, listing 6.11 , 6.12 , run bundle exec rake test listing 6.13 running linux xubuntu
1) error: applicationhelpertest#test_full_title_helper: nameerror: uninitialized constant applicationhelpertest::fill_in test/helpers/application_helper_test.rb:5:in `block in '
when remove email validation test passes.
test/models/user_test.rb
require 'test_helper' class usertest < activesupport::testcase def setup @user = user.new(name: "example user", email: "user@example.com") end test "should valid" assert @user.valid? end test "name should present" @user.name = "" assert_not @user.valid? end test "email should present" @user.email = " " assert_not @user.valid? end end
app/models/user.rb
class user < activerecord::base validates :name, presence: true validates :email, presence: true end
i think must have application helper. code in helper:
require 'test_helper' class applicationhelpertest < actionview::testcase test "full title helper" assert_equal full_title, fill_in assert_equal full_title("help"), fill_in end end
it's because test trying constant called fill_in
, doesn't exist. tutorial asking replace fill_in
proper values.
Comments
Post a Comment