我找不到此错误的任何解释,但是在运行时:
rake test
或bundle exec rake test
我得到:
NoMethodError: undefined method `ignore' for Warning:Module
/Users/przemyslaw/projects/writefully/config/initializers/warning.rb:4:in `block in <top (required)>'
/Users/przemyslaw/projects/writefully/config/initializers/warning.rb:3:in `each'
/Users/przemyslaw/projects/writefully/config/initializers/warning.rb:3:in `<top (required)>'
/Users/przemyslaw/projects/writefully/config/environment.rb:5:in `<top (required)>'
/Users/przemyslaw/projects/writefully/test/test_helper.rb:2:in `require'
/Users/przemyslaw/projects/writefully/test/test_helper.rb:2:in `<top (required)>'
/Users/przemyslaw/projects/writefully/test/controllers/comments_controller_test.rb:1:in `require'
/Users/przemyslaw/projects/writefully/test/controllers/comments_controller_test.rb:1:in `<top (required)>'
Tasks: TOP => test:run
(See full trace by running task with --trace)
我正在关注codemy.net上的教程,并且该项目没有任何复杂或特殊之处。我只生成了一个新的Rails应用程序,几个模型和控制器,现在当我尝试运行测试时,它给了我这个错误。目前,我的测试文件中没有任何测试,因此与测试无关。似乎警告文件中的'ignore'方法存在一些问题:
config / initializers / warning.rb
# Rails will load this logic before booting up Rails server
unless Rails.env.development?
Gem.path.each do |path|
Warning.ignore(//, path)
end
end
任何帮助或想法将不胜感激。我正在使用Rails 4.2.10和ruby 2.5.8。