-
-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update resource before to process email so that partner invitation emails have correct body #3027
Merged
edwinthinks
merged 11 commits into
rubyforgood:main
from
italomatos:hotfix/2985-wrong-message-email-to-partner-organization
Aug 7, 2022
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
473b9f9
remove rspec-retry
italomatos bbf0677
Revert "remove rspec-retry"
italomatos 49cf2f1
add spec to partner invite service and hotfix to send correct email
italomatos f6ba45f
add spec to check subject and body invite
italomatos b549a09
refactory to use user model
8510850
fix partner invite service spec
8e0d1cb
fix invitation_instructions to partner users
fbcd32a
fix invitation instructions texts and add comment to explain the reas…
ecff9f8
fix spec expect message
54f83b9
Merge branch 'main' of github.com:italomatos/human-essentials into ho…
8db5edd
Merge branch 'main' into hotfix/2985-wrong-message-email-to-partner-o…
edwinthinks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
RSpec.describe CustomDeviseMailer, type: :mailer, skip_seed: true do | ||
describe "#invitation_instructions" do | ||
let(:user) { create(:user) } | ||
let(:mail) { described_class.invitation_instructions(user, SecureRandom.uuid) } | ||
|
||
context "when partner is invited" do | ||
let(:partner) do | ||
partner = create(:partner, :uninvited) | ||
partner.profile.primary_user.delete | ||
partner.profile.reload | ||
partner | ||
end | ||
|
||
let(:user) { create(:user, partner: partner.profile) } | ||
|
||
it "invites to primary user" do | ||
expect(mail.subject).to eq("You've been invited to be a partner with #{user.partner.organization.name}") | ||
expect(mail.html_part.body).to include("You've been invited to become a partner with <strong>#{user.partner.organization.name}!</strong>") | ||
end | ||
end | ||
|
||
context "when other partner users invited" do | ||
let(:partner) { create(:partner) } | ||
let(:user) { create(:user, partner: partner.profile) } | ||
|
||
it "invites to partner user" do | ||
expect(mail.subject).to eq("You've been invited to #{user.partner.name}'s partnerbase account") | ||
expect(mail.html_part.body).to include("You've been invited to <strong>#{user.partner.name}'s</strong> account for requesting items from <strong>#{user.partner.organization.name}!") | ||
end | ||
end | ||
|
||
context "when user is invited" do | ||
let(:user) { create(:user) } | ||
|
||
it "invites to user" do | ||
expect(mail.subject).to eq("Your Human Essentials App Account Approval") | ||
expect(mail.html_part.body).to include("Your request has been approved and you're invited to become an user of the Human Essentials inventory management system!") | ||
end | ||
end | ||
end | ||
end |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor suggestion, can you add a comment to explain why this was added? I sense it will be unclear to future maintainers about why this was added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @edwinthinks, I agree. Is it ok? Thanks