rspecbundlerruby-on-rails-5.2ruby-2.7

After updating ruby to 2.7.1 rspec tests throws error `Bundler::GemfileError for status code 4 but Bundler::GemfileError is already registered`


After updating ruby to 2.7.1 (via rvm) ran rspec spec and received error:

Trying to register Bundler::GemfileError for status code 4 but Bundler::GemfileError is already registered
    # /Users/----/.rvm/gems/ruby-2.7.1@xmx/gems/bundler-2.1.4/lib/bundler.rb:7:in `require_relative'
    # /Users/----/.rvm/gems/ruby-2.7.1@xmx/gems/bundler-2.1.4/lib/bundler.rb:7:in `<top (required)>'
    # ./config/boot.rb:4:in `require'
    # ./config/boot.rb:4:in `<top (required)>'
    # ./config/application.rb:1:in `require'
    # ./config/application.rb:1:in `<top (required)>'
    # ./config/environment.rb:2:in `require_relative'
    # ./config/environment.rb:2:in `<top (required)>'
    # ./spec/spec_helper.rb:18:in `require'
    # ./spec/spec_helper.rb:18:in `<top (required)>'
    # ./spec/models/activation_spec.rb:1:in `require'
    # ./spec/models/activation_spec.rb:1:in `<top (required)>

Solution

  • A lot of the discussions I found on this error were pretty old. Then, finally stumbled upon this recent github discussion:

    Running the following solved my issue:

    gem update --system 3.0.8 && gem update --system

    Note: To run update without installing documentation

    gem update --system 3.0.8 --no-document && gem update --system --no-document