Admin mailer parameterization (#25759)
This commit is contained in:
@@ -7,7 +7,7 @@ RSpec.describe AdminMailer do
|
||||
let(:sender) { Fabricate(:account, username: 'John') }
|
||||
let(:recipient) { Fabricate(:account, username: 'Mike') }
|
||||
let(:report) { Fabricate(:report, account: sender, target_account: recipient) }
|
||||
let(:mail) { described_class.new_report(recipient, report) }
|
||||
let(:mail) { described_class.with(recipient: recipient).new_report(report) }
|
||||
|
||||
before do
|
||||
recipient.user.update(locale: :en)
|
||||
@@ -27,7 +27,7 @@ RSpec.describe AdminMailer do
|
||||
describe '.new_appeal' do
|
||||
let(:appeal) { Fabricate(:appeal) }
|
||||
let(:recipient) { Fabricate(:account, username: 'Kurt') }
|
||||
let(:mail) { described_class.new_appeal(recipient, appeal) }
|
||||
let(:mail) { described_class.with(recipient: recipient).new_appeal(appeal) }
|
||||
|
||||
before do
|
||||
recipient.user.update(locale: :en)
|
||||
@@ -47,7 +47,7 @@ RSpec.describe AdminMailer do
|
||||
describe '.new_pending_account' do
|
||||
let(:recipient) { Fabricate(:account, username: 'Barklums') }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:mail) { described_class.new_pending_account(recipient, user) }
|
||||
let(:mail) { described_class.with(recipient: recipient).new_pending_account(user) }
|
||||
|
||||
before do
|
||||
recipient.user.update(locale: :en)
|
||||
@@ -69,7 +69,7 @@ RSpec.describe AdminMailer do
|
||||
let(:links) { [] }
|
||||
let(:statuses) { [] }
|
||||
let(:tags) { [] }
|
||||
let(:mail) { described_class.new_trends(recipient, links, tags, statuses) }
|
||||
let(:mail) { described_class.with(recipient: recipient).new_trends(links, tags, statuses) }
|
||||
|
||||
before do
|
||||
recipient.user.update(locale: :en)
|
||||
|
@@ -5,16 +5,16 @@
|
||||
class AdminMailerPreview < ActionMailer::Preview
|
||||
# Preview this email at http://localhost:3000/rails/mailers/admin_mailer/new_pending_account
|
||||
def new_pending_account
|
||||
AdminMailer.new_pending_account(Account.first, User.pending.first)
|
||||
AdminMailer.with(recipient: Account.first).new_pending_account(User.pending.first)
|
||||
end
|
||||
|
||||
# Preview this email at http://localhost:3000/rails/mailers/admin_mailer/new_trends
|
||||
def new_trends
|
||||
AdminMailer.new_trends(Account.first, PreviewCard.joins(:trend).limit(3), Tag.limit(3), Status.joins(:trend).where(reblog_of_id: nil).limit(3))
|
||||
AdminMailer.with(recipient: Account.first).new_trends(PreviewCard.joins(:trend).limit(3), Tag.limit(3), Status.joins(:trend).where(reblog_of_id: nil).limit(3))
|
||||
end
|
||||
|
||||
# Preview this email at http://localhost:3000/rails/mailers/admin_mailer/new_appeal
|
||||
def new_appeal
|
||||
AdminMailer.new_appeal(Account.first, Appeal.first)
|
||||
AdminMailer.with(recipient: Account.first).new_appeal(Appeal.first)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user