Rails Minitest crash on failed tests

Minitest crashes every time a test fails when I run rails test (Rails 5 and Ruby 2.4.2). For example, I made a simple test fail by switching assert to assert_not :

 Failure: TransactionTest#test_transaction_should_be_valid [/home/.../test/models/transaction_test.rb:11]: Expected true to be nil or false /home/.../.rvm/gems/ruby-2.4.2/gems/railties-5.1.4/lib/rails/test_unit/reporter.rb:70:in `method': undefined method `test_transaction_should_be_valid' for class `Minitest::Result' (NameError) 

If the test passes, then the entire report will be successful, and I will receive a report. If only one test fails, I get the error message above. I defined test_transaction_should_be_valid in my transaction_test.rb file, and the proof of this is that it runs smoothly when the test passes.

I'm stuck on this now. Any ideas as to what could be causing this?

+5
source share
1 answer

Apparently, Rails is not yet fully compatible with Minitest 5.10 / 5.11: https://github.com/seattlerb/minitest/issues/730 They sent a monkey deck to spill us.

Rails apparently also fixed this at the edge. https://github.com/rails/rails/pull/31624

This error disappeared when I pulled it from the lead branch. Put this in your gemfile:

 gem 'rails', git: 'https://github.com/rails/rails.git' 

edit: promotion with comments (thanks coco9nyc):

or you can try lowering minitest:

 gem 'minitest', '5.10.3' 
+7
source

Source: https://habr.com/ru/post/1274662/


All Articles