Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 7.1 upgrade: using deprecated preview_path= #2703

Closed
juanxcerv opened this issue Oct 17, 2023 · 6 comments · Fixed by #2706
Closed

Rails 7.1 upgrade: using deprecated preview_path= #2703

juanxcerv opened this issue Oct 17, 2023 · 6 comments · Fixed by #2706

Comments

@juanxcerv
Copy link

What Ruby, Rails and RSpec versions are you using?

Ruby version: 3.2.2
Rails version: 7.1.1
RSpec version: 3.12

Observed behaviour

Inside of rspec-rails-6.0.3/lib/rspec-rails.rb it's using the deprecated method preview_path:

 options.preview_path = "#{::Rails.root}/spec/mailers/previews"

which ultimately gets set as a config for action_mailer:

      initializer "rspec_rails.action_mailer",
                  before: "action_mailer.set_configs" do |app|
                    setup_preview_path(app)
                  end

and causes the following message to trigger:

        ActionMailer.deprecator.warn(<<-MSG.squish)
          Using preview_path= option is deprecated and will be removed in Rails 7.2.
          Please use preview_paths= instead.
        MSG

Expected behaviour

No deprecation warning

Thanks!

@pirj pirj added the rails7 label Oct 18, 2023
@pirj
Copy link
Member

pirj commented Oct 18, 2023

Thanks for the in-depth report, Do you want to send a PR to fix this, @juanxcerv ?

@dannyy83
Copy link

dannyy83 commented Oct 24, 2023

This can be reproduced with this clean ruby 7.1.1 project: https://github.com/dannyy83/debug_action_mailer_deprication

You can see the deprication warning being raised by visiting the /rails/mailers/ url.

@alexevanczuk
Copy link

@JonRowe Thank you for fixing!! Would you be able to cut a new release 🙏🏼

@jathayde
Copy link

Hit this during an upgrade to Ruby 3.3.5 / Rails 7.2.x. Running on master resolved that exception around preview_path=.

@JonRowe
Copy link
Member

JonRowe commented Oct 10, 2024

Thats funny we don't have a master branch, prehaps you meant main but also this was released in 6.1.0 in 2023, we're on 7.0.x now which also has that fix.

@jathayde
Copy link

My apologies. Main. I was still experiencing this in rspec-rails 7.0. May have been a cache issue, but had to switch to the github call in the gemfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants