ruby-on-railsrubygemsruby-on-rails-6ruby-on-rails-6.1

Rails 6.1.5: uninitialized constant Mail::TestMailer


Why am i getting 'uninitialized constant Mail::TestMailer' error with "Rails 6.1.5 & Ruby 3.1.0" while working without problems "Rails 6.1.5 & Ruby 3.0.1" ?


Solution

  • Found following from NEWS for Ruby 3.1.0.

    The following default gems are now bundled gems.
    
    net-ftp 0.1.3
    net-imap 0.2.2
    net-pop 0.1.1
    net-smtp 0.3.1
    matrix 0.4.2
    prime 0.1.2
    debug 1.4.0
    

    So, i just added next 3 lines into GemFile. It worked fine.

    gem 'net-smtp' # to send email
    gem 'net-imap' # for rspec
    gem 'net-pop'  # for rspec