Actualicé a Rails 7 y Ruby 3.1. Al intentar ejecutar pruebas con rspec , recibí el siguiente error. ¿Cómo puedo arreglarlo?
An error occurred while loading rails_helper. Failure/Error: require File.expand_path('../config/environment', __dir__) LoadError: cannot load such file -- net/smtp # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require' # .../gems/zeitwerk-2.5.2/lib/zeitwerk/kernel.rb:36:in `require' # .../gems/mail-2.7.1/lib/mail.rb:9:in `<module:Mail>' # .../gems/mail-2.7.1/lib/mail.rb:3:in `<main>' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' # .../gems/zeitwerk-2.5.2/lib/zeitwerk/kernel.rb:36:in `require' # .../bundler/gems/rails-6a0f6c4d70b1/actionmailbox/lib/action_mailbox/mail_ext.rb:3:in `<main>' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' # .../gems/zeitwerk-2.5.2/lib/zeitwerk/kernel.rb:36:in `require' # .../bundler/gems/rails-6a0f6c4d70b1/actionmailbox/lib/action_mailbox.rb:3:in `<main>' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' # .../gems/zeitwerk-2.5.2/lib/zeitwerk/kernel.rb:36:in `require' # .../bundler/gems/rails-6a0f6c4d70b1/actionmailbox/lib/action_mailbox/engine.rb:9:in `<main>' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' # .../gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' # .../gems/zeitwerk-2.5.2/lib/zeitwerk/kernel.rb:36:in `require' # ./config/application.rb:11:in `<top (required)>' # ./config/environment.rb:2:in `require_relative' # ./config/environment.rb:2:in `<top (required)>' # ./spec/rails_helper.rb:4:in `require' # ./spec/rails_helper.rb:4:in `<top (required)>' No examples found. Finished in 0.00005 seconds (files took 0.57758 seconds to load) 0 examples, 0 failures, 1 error occurred outside of examplesUPD: el 6 de enero de 2022 se lanzó Rails 7.0.1:
El enfoque de esta versión es brindar soporte a Ruby 3.1
Entre otros problemas relacionados con Ruby 3.1, trajo una solución para este problema. Así que actualice a Rails >= 7.0.1 .
Agregue gem 'net-smtp', require: false a su Gemfile y ejecute bundle .
Del mismo modo, supongo que puede tener problemas con net-imap y net-pop y, por lo tanto, debe agregarlos hasta que se publique una nueva versión de mail gem.
Solicitudes de extracción y problemas relacionados: