forked from houdiniproject/houdini
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #962 from CommitChange/dedication-contact-on-recei…
…pt-email add dedication contact details to receipt emails
- Loading branch information
Showing
3 changed files
with
74 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,11 +22,20 @@ | |
)] | ||
} | ||
end | ||
end | ||
|
||
|
||
|
||
|
||
factory :donation_with_dedication do | ||
dedication { { | ||
contact: { | ||
email: '[email protected]', | ||
phone: '234-343-3234', | ||
address: '123 Four' | ||
}, | ||
name: 'our loved one', | ||
note: 'we miss them dearly', | ||
type: 'memory' | ||
}.to_json } | ||
end | ||
end | ||
|
||
factory :fv_poverty_donation, class: 'Donation' do | ||
nonprofit {association :fv_poverty} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,6 +255,44 @@ | |
expect(mail.subject).to include supporter.email | ||
end | ||
end | ||
|
||
|
||
context 'when dedication is not set' do | ||
before(:each) { | ||
expect(QueryUsers).to receive(:nonprofit_user_emails).and_return(['[email protected]']) | ||
} | ||
|
||
let(:supporter) { create(:supporter_base)} | ||
let(:donation) { create(:donation_base, supporter: supporter, nonprofit: supporter.nonprofit)} | ||
let(:payment) { create(:payment_base, donation: donation)} | ||
|
||
let!(:mail) { DonationMailer.nonprofit_payment_notification( | ||
donation.id, | ||
payment.id | ||
) } | ||
|
||
it 'does not include the dedication section' do | ||
expect(mail.body.encoded).to_not include "Acknowledgement Phone" | ||
end | ||
end | ||
|
||
context 'when dedication is set' do | ||
before(:each) { | ||
expect(QueryUsers).to receive(:nonprofit_user_emails).and_return(['[email protected]']) | ||
} | ||
|
||
let(:supporter) { create(:supporter_base)} | ||
let(:donation) { create(:donation_with_dedication, supporter: supporter, nonprofit: supporter.nonprofit)} | ||
let(:payment) { create(:payment_base, donation: donation)} | ||
|
||
let!(:mail) { DonationMailer.nonprofit_payment_notification( | ||
donation.id, | ||
payment.id | ||
) } | ||
|
||
it 'does not include the dedication section' do | ||
expect(mail.body.encoded).to include "Acknowledgement Phone" | ||
expect(mail.body.encoded).to include "234-343-3234" | ||
end | ||
end | ||
end | ||
end | ||
end |