After upgrading from Rails 6 to 7, I'm getting this error when trying to test out a mailer that was working just fine before.
NoMethodError (undefined method `preview_path=' for ActionMailer::Base:Class
Did you mean? preview_paths=
preview_paths
_view_paths=):
I've looked this up and I know that preview_path was deprecated in favor of preview_paths, but I'm not using preview_path anywhere in my code and I've tried removing all gems related to my mailers such as letter_opener. This is saying that the error is coming from ActionMailer::Base:Class but shouldn't that be using it's own updated methods? I can't find anything on the web related to this error and it's driving me nuts! This is all I have in my mailer and it's raising the error from the first line class ApplicationMailer < ActionMailer::Base:
class ApplicationMailer < ActionMailer::Base
add_template_helper(EmailHelper)
default from: 'Test'
layout 'mailer'
end
As @dbugger in the comments helped me realize, I updated rspec from 5.0.3 to 7.0.1 and that solved the issue.