小编hwo*_*rth的帖子

MiniTest错误:"NameError:uninitialized constant"

我正在关注Michael Hartl的"Ruby on Rails教程:学习Web开发",并创建检查用户姓名和电子邮件的测试长度的有效性(名称最多50个字符,电子邮件为255个字符).内容test/helpers/application_helper_test.rb是:

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
Run Code Online (Sandbox Code Playgroud)

运行时bundle exec rake test,所有测试都通过,但我看到以下消息在结尾处标记为错误:

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>'
Run Code Online (Sandbox Code Playgroud)

任何想法如何解决这一问题?

ruby rake ruby-on-rails minitest nameerror

5
推荐指数
1
解决办法
4873
查看次数

标签 统计

minitest ×1

nameerror ×1

rake ×1

ruby ×1

ruby-on-rails ×1