When running rails test that fails, in a 5.1.4 rails app it throws the following 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)
However, if the test passes, the minitest report is shown without error messages at all. I tried removing the minitest-reporters gem, but the NameError message does not go away. Seems to be related to the spring server. I also tried shutting down all spring ps. Regarding `test_should_get_help' is a simple tests and despite deleting it, the error always puts the last written test in its place.
This is the 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]
I found this thread: https://github.com/seattlerb/minitest/issues/730, which promises a fix to MiniTest. The fix will be available in a future Rails update, or now via Edge Rails.
I added a temporary entry to my Gemfile
to revert MiniTest to the previous stable version,
# temporary fix to minitest 5.11.1 issue
gem 'minitest', '~>5.10.3'
and then ran
bundle update minitest
It seems to work (but I'm still getting failed tests).
YMMV
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With