FEATURE: resending invite should include original custom message

https://meta.discourse.org/t/will-resent-invite-include-original-custom-message/64699
This commit is contained in:
Arpit Jalan
2017-06-30 18:13:33 +05:30
parent c1580b9d36
commit 16d356ab4e
5 changed files with 20 additions and 11 deletions
+6 -4
View File
@@ -5,9 +5,9 @@ describe InviteMailer do
describe "send_invite" do
context "invite to site" do
let(:invite) { Fabricate(:invite) }
context "default invite message" do
let(:invite) { Fabricate(:invite) }
let(:invite_mail) { InviteMailer.send_invite(invite) }
it 'renders the invitee email' do
@@ -36,9 +36,10 @@ describe InviteMailer do
end
context "custom invite message" do
let(:invite) { Fabricate(:invite, custom_message: "Hey, you should join this forum!") }
context "custom message includes invite link" do
let(:custom_invite_mail) { InviteMailer.send_invite(invite, "Hey, you should join this forum!") }
let(:custom_invite_mail) { InviteMailer.send_invite(invite) }
it 'renders the invitee email' do
expect(custom_invite_mail.to).to eql([invite.email])
@@ -76,9 +77,9 @@ describe InviteMailer do
context "invite to topic" do
let(:trust_level_2) { build(:user, trust_level: 2) }
let(:topic) { Fabricate(:topic, excerpt: "Topic invite support is now available in Discourse!", user: trust_level_2) }
let(:invite) { topic.invite(topic.user, 'name@example.com') }
context "default invite message" do
let(:invite) { topic.invite(topic.user, 'name@example.com') }
let(:invite_mail) { InviteMailer.send_invite(invite) }
it 'renders the invitee email' do
@@ -123,7 +124,8 @@ describe InviteMailer do
end
context "custom invite message" do
let(:custom_invite_mail) { InviteMailer.send_invite(invite, "Hey, I thought you might enjoy this topic!") }
let(:invite) { topic.invite(topic.user, 'name@example.com', nil, "Hey, I thought you might enjoy this topic!") }
let(:custom_invite_mail) { InviteMailer.send_invite(invite) }
it 'renders custom_message' do
expect(custom_invite_mail.body.encoded).to match("Hey, I thought you might enjoy this topic!")