Skip to content

Instantly share code, notes, and snippets.

@palkan
Created July 8, 2022 16:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save palkan/7f3a8cb3c904449e089b03448d14185d to your computer and use it in GitHub Desktop.
Save palkan/7f3a8cb3c904449e089b03448d14185d to your computer and use it in GitHub Desktop.
mailers_preview_spec.rb
# frozen_string_literal: true
require "rails_helper"
# Automatically smoke-test all mailer previews
describe "/rails/mailers" do
subject { response }
ActionMailer::Preview.all.each do |preview|
next if preview.emails.empty?
describe "/#{preview.preview_name}" do
preview.emails.each do |email|
specify "/#{email}" do
get "/rails/mailers/#{preview.preview_name}/#{email}"
is_expected.to be_successful
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment