mercredi 20 janvier 2016

NameError: uninitialized constant ApplicationHelperTest::Fill_IN

I am new to programming. I get this error message when I add the last test in this code from Ruby on Rails Tutorial, from listing 6.11 and 6.12 and then run the bundle exec rake test Listing 6.13 I am 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 '

This is my code I have tried many times. When I remove the email validation the 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 be valid" do assert @user.valid? end

test "name should be present" do @user.name = "" assert_not @user.valid? end

test "email should be present" do @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 it must have something to do with the Application Helper. this is the code in the helper:

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

Aucun commentaire:

Enregistrer un commentaire