I was updating the Ruby version on my rails application. I updated from version 2.7.5 to version 3.0.6. I fixed all the broken dependencies and my project is successfully launched using the rails s command. But for some reason I can’t run rspec tests.
In my config/application.rb file the following line is throwing an error.
Bundler.require(*Rails.groups)
The error is like this:
ArgumentError:
wrong number of arguments (given 4, expected 3)
# ./config/application.rb:16:in `<top (required)>'
# ./config/environment.rb:4:in `require_relative'
# ./config/environment.rb:4:in `<top (required)>'
# ./spec/rails_helper.rb:8:in `<top (required)>'
What's strange is that this error only reproduces when there is a :test or 'test' in the Rails.groups array.
That is, if, for example, you give the Bundler.require such an array as input -> [:default] then there will be no error
version of my rails app: 6.1.7.4
After some time I found the answer. The problem was in the capybara library. For some reason, the version I was using was not marked as unavailable for Ruby 3, updating to a more recent one worked as it should.