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

Fix preview paths #2706

Merged
merged 6 commits into from
Nov 14, 2023
Merged

Fix preview paths #2706

merged 6 commits into from
Nov 14, 2023

Conversation

JonRowe
Copy link
Member

@JonRowe JonRowe commented Oct 23, 2023

On Rails 7.1 they changed the preview path setup for mailers to be multiple rather than singular, this PR handles that change conditionally in the railtie and fixes our test setup around the mailers. Fixes #2703.

@JonRowe
Copy link
Member Author

JonRowe commented Oct 23, 2023

/cc @alexevanczuk

if ENV['CUSTOM_PREVIEW_PATH']
config.action_mailer.preview_path = ENV['CUSTOM_PREVIEW_PATH']
if Rails::VERSION::STRING.start_with?('7.1')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JonRowe Won't this fail with Rails 7.2+? Would it be better to do a >= comparison?

@alexevanczuk
Copy link

Hey @JonRowe let me know if this is something that you're still working on or if I can help out!

@JonRowe JonRowe merged commit 9da2a64 into main Nov 14, 2023
19 checks passed
@JonRowe JonRowe deleted the fix-preview-paths branch November 14, 2023 13:36
JonRowe added a commit that referenced this pull request Nov 14, 2023
@TylerRick
Copy link

Can you please make a release that includes this? 🙏

The current release (6.0.3) does not include this, and is therefore not compatible with Rails 7.1 (when using config.active_support.disallowed_deprecation = :raise, as some of us do). 😞

@TylerRick
Copy link

A related question: While waiting for a release, is there an easy way to use the edge/unreleased version?

I tried gem 'rspec-rails', github: 'rspec/rspec-rails' but run into this error (unless I also explicitly list every rspec sub-project in my Gemfile):

Could not find gem 'rspec-mocks (= 3.13.0.pre)', which is required by gem 'rspec-rails', in rubygems repository https://rubygems.org/ or
installed locally.

@dannyy83
Copy link

@TylerRick I'm in the same situation as you, and this works for me:

  %w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
    gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'main'
  end

@TylerRick
Copy link

@TylerRick I'm in the same situation as you, and this works for me:

  %w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
    gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'main'
  end

Thanks, @dannyy83, and glad to hear I'm not alone. I landed on something similar. Too bad you have to override all of those dependencies, but I guess it makes sense, due to the version constraint on "= 3.13.0.pre)".

@JonRowe
Copy link
Member Author

JonRowe commented Nov 21, 2023

Fix released in 6.1.0 for Rails 7.1 support.

Side note, if you depend on the <major>-<minor>-maintenance branch you shouldn't need to pin the rest of RSpec, but we only tend to ship bugfixes to those.

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

Successfully merging this pull request may close these issues.

Rails 7.1 upgrade: using deprecated preview_path=
5 participants