ruby-on-railsrubyminitestargument-error

minitest_plugin.rb:9 getting wrong number of arguments


~/Sites/sample_app$ rails test
Running via Spring preloader in process 24338
Run options: --seed 58780

Running:

..

Finished in 0.292172s, 6.8453 runs/s, 6.8453 assertions/s.
/var/lib/gems/2.3.0/gems/railties-5.1.0/lib/rails/test_unit/minitest_plugin.rb:9:in `aggregated_results': wrong number of arguments (given 1, expected 0) (ArgumentError)

I don't understand why I am getting this error. I Can't seem to find anyone with this specific error. I'm following the tutorial https://www.railstutorial.org/book/static_pages. This error follows the rails test command. Running Ubuntu and rails 5.1 if that helps. I'm not passing any arguments so I don't understand why I am getting this error.

My test file looks like :

    require 'test_helper'

    class StaticPagesControllerTest < ActionDispatch::IntegrationTest

    test "should get home" do
      get static_pages_home_url
      assert_response :success
    end

    test "should get help" do
      get static_pages_help_url
      assert_response :success
    end

Solution

  • This is actually a bug in rails, revealed by minitest update to 5.10.2 as said here and it has already been fixed here.

    As the pull request is only 10 hours old (at the time of writing), it has not yet been released, although it's already merged.

    In the mean time, you can specify in your Gemfile:

    gem 'minitest', '~> 5.10', '!= 5.10.2'
    

    Edit

    Don't forget to bundle update minitest