10
~/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
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Josh HUmphrey
  • 273
  • 2
  • 10

5 Answers5

20

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

Jaffa
  • 12,442
  • 4
  • 49
  • 101
5

Hey I'm doing this exact tutorial and followed the top solution and it fixed my issue, specifically (for us total noobs) I did this to my Gemfile

group :test do
  gem 'rails-controller-testing', '0.1.1'
  gem 'minitest-reporters',       '1.1.9'
  gem 'guard',                    '2.13.0'
  gem 'guard-minitest',           '2.4.4'
  gem 'minitest', '~> 5.10', '!= 5.10.2' # add this here to fix error
end
Jim
  • 83
  • 8
3

It turns out that in my test/test_helper.rb I needed a line of code that was missing. I added this before "class ActiveSupport::TestCase".

    Minitest::Reporters.use!

This gave me a passing result for my test with no strange argument error. Hope this helps someone for the future!

Josh HUmphrey
  • 273
  • 2
  • 10
2

Problem is in minitest 5.10.2. Downgrading to 5.10.1 fixes it.

Add this line in test group in Gemfile

gem 'minitest', '5.10.1'

Then run following commands

bundle update minitest
rails test

The issue is resolved

abhishek
  • 73
  • 1
  • 8
0

I also encountered this error. I tried using the top voted solution, but rails told me that bundle has locked minitest to 5.10.2. Instead, I just did a gem update minitest and my tests ran without the weird error.

olegdeleon
  • 13
  • 5
  • If you changed only the minitest gem in the Gemfile, try updating it with `bundle update --source minitest` – tschoppi May 19 '17 at 15:10
  • OP: simply read the message bundler gives you, it tell you to use `bundle update` to change the locked version... – Jaffa May 22 '17 at 14:21