mirror of https://github.com/rails/rails
Merge pull request #45935 from the-spectator/add_bcc_to_mailer_preview
Show BCC field in mailer preview
This commit is contained in:
commit
bee6167977
|
@ -1,3 +1,7 @@
|
|||
* Show BCC recipients when present in Action Mailer previews.
|
||||
|
||||
*Akshay Birajdar*
|
||||
|
||||
* Extend `routes --grep` to also filter routes by matching against path.
|
||||
|
||||
Example:
|
||||
|
|
|
@ -80,6 +80,11 @@
|
|||
<dd id="cc"><%= @email.header['cc'] %></dd>
|
||||
<% end %>
|
||||
|
||||
<% if @email.bcc %>
|
||||
<dt>BCC:</dt>
|
||||
<dd id="bcc"><%= @email.header['bcc'] %></dd>
|
||||
<% end %>
|
||||
|
||||
<dt>Date:</dt>
|
||||
<dd id="date"><%= Time.current.rfc2822 %></dd>
|
||||
|
||||
|
|
|
@ -877,6 +877,36 @@ module ApplicationTests
|
|||
assert_match "<title>Mailer Preview for notifier#foo</title>", last_response.body
|
||||
end
|
||||
|
||||
test "mailer preview sender tags" do
|
||||
mailer "notifier", <<-RUBY
|
||||
class Notifier < ActionMailer::Base
|
||||
default from: "from@example.com"
|
||||
def foo
|
||||
mail to: "to@example.org", cc: "cc@example.com", bcc: "bcc@example.com"
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
|
||||
text_template "notifier/foo", <<-RUBY
|
||||
Hello, World!
|
||||
RUBY
|
||||
|
||||
mailer_preview "notifier", <<-RUBY
|
||||
class NotifierPreview < ActionMailer::Preview
|
||||
def foo
|
||||
Notifier.foo
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
|
||||
app("development")
|
||||
|
||||
get "/rails/mailers/notifier/foo"
|
||||
assert_match "<dd id=\"to\">to@example.org</dd>", last_response.body
|
||||
assert_match "<dd id=\"cc\">cc@example.com</dd>", last_response.body
|
||||
assert_match "<dd id=\"bcc\">bcc@example.com</dd>", last_response.body
|
||||
end
|
||||
|
||||
private
|
||||
def build_app
|
||||
super
|
||||
|
|
Loading…
Reference in New Issue