Lors de l'exécution d'un test de rails qui échoue, dans une application rails 5.1.4, l'erreur suivante est générée : NameError.
Traceback (most recent call last):
27: from -e:1:in `<main>'
26: from /Users/User/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
25: from /Users/User/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
24: from /Users/User/.rvm/gems/ruby-2.5.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
23: from /Users/User/.rvm/gems/ruby-2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
22: from /Users/User/.rvm/gems/ruby-2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
21: from /Users/User/.rvm/gems/ruby-2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
20: from /Users/User/.rvm/gems/ruby-2.5.0/gems/spring-2.0.2/lib/spring/application.rb:171:in `serve'
19: from /Users/User/.rvm/gems/ruby-2.5.0/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork'
18: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:63:in `block in autorun'
17: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:136:in `run'
16: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:159:in `__run'
15: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:159:in `map'
14: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:159:in `block in __run'
13: from /Users/User/.rvm/gems/ruby-2.5.0/gems/railties-5.1.4/lib/rails/test_unit/line_filtering.rb:9:in `run'
12: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:319:in `run'
11: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:347:in `with_info_handler'
10: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:360:in `on_signal'
9: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:320:in `block in run'
8: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:320:in `each'
7: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:321:in `block (2 levels) in run'
6: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:334:in `run_one_method'
5: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:785:in `record'
4: from /Users/v/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:785:in `each'
3: from /Users/User/.rvm/gems/ruby-2.5.0/gems/minitest-5.11.1/lib/minitest.rb:786:in `block in record'
2: from /Users/User/.rvm/gems/ruby-2.5.0/gems/railties-5.1.4/lib/rails/test_unit/reporter.rb:23:in `record'
1: from /Users/User/.rvm/gems/ruby-2.5.0/gems/railties-5.1.4/lib/rails/test_unit/reporter.rb:70:in `format_rerun_snippet'
/Users/User/.rvm/gems/ruby-2.5.0/gems/railties-5.1.4/lib/rails/test_unit/reporter.rb:70:in `method': undefined method `test_should_get_help' for class `Minitest::Result' (NameError)
Cependant, si le test passe, le rapport du minitest s'affiche sans aucun message d'erreur. J'ai essayé de supprimer la gemme minitest-reporters, mais le message NameError ne disparaît pas. Il semble que cela soit lié au serveur Spring. J'ai également essayé de fermer tous les ps de Spring. En ce qui concerne `test_should_get_help' (le test doit obtenir de l'aide) est un simple test et malgré sa suppression, l'erreur met toujours le dernier test écrit à sa place.
Voici le Gemfile
source 'https://rubygems.org'
gem 'rails', '5.1.4'
gem 'bcrypt', '3.1.11'
gem 'faker', '1.7.3'
gem 'carrierwave', '1.2.2'
gem 'mini_magick', '4.7.0'
gem 'will_paginate', '3.1.6'
gem 'bootstrap-will_paginate', '1.0.0'
gem 'bootstrap-sass', '3.3.7'
gem 'puma', '3.9.1'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'jquery-rails', '4.3.1'
gem 'turbolinks', '5.0.1'
gem 'jbuilder', '2.7.0'
group :development, :test do
gem 'sqlite3', '1.3.13'
gem 'byebug', '9.0.6', platform: :mri
end
group :development do
gem 'web-console', '3.5.1'
gem 'listen', '3.1.5'
gem 'spring', '2.0.2'
gem 'spring-watcher-listen', '2.0.1'
end
group :test do
gem 'rails-controller-testing', '1.0.2'
gem 'minitest-reporters', '1.1.14'
gem 'guard', '2.14.1'
gem 'guard-minitest', '2.4.6'
end
group :production do
gem 'pg', '0.20.0'
gem 'fog', '1.42'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]