Skip to content

Commit 182fcd2

Browse files
committed
Add preview for authorship notifier
1 parent 1aff1ca commit 182fcd2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
3+
module BetterTogether
4+
# Preview at /rails/mailers/better_together/authorship_mailer
5+
class AuthorshipMailerPreview < ActionMailer::Preview
6+
include FactoryBot::Syntax::Methods
7+
include BetterTogether::ApplicationHelper
8+
9+
# Preview this email at
10+
# /rails/mailers/better_together/authorship_mailer/authorship_changed_notification
11+
def authorship_changed_notification
12+
host_platform || create(:platform, :host)
13+
14+
actor = create(:user, :confirmed)
15+
recipient = create(:user, :confirmed)
16+
# Use build to avoid Elasticsearch callbacks on BetterTogether::Page
17+
page = build(:page)
18+
19+
BetterTogether::AuthorshipMailer
20+
.with(page: page,
21+
recipient: recipient.person,
22+
action: 'added',
23+
actor_name: actor.person.name)
24+
.authorship_changed_notification
25+
end
26+
end
27+
end

0 commit comments

Comments
 (0)