-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add welcome email when create organization. Add specs
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,5 +1,35 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe UserMailer, type: :mailer do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
|
||
describe "welcome" do | ||
|
||
before do | ||
@organization = create(:organization) | ||
end | ||
|
||
let!(:mail) { UserMailer.welcome(@organization.user) } | ||
|
||
it "should send from example" do | ||
expect(mail.from).to eq([ "from@example.com"]) | ||
end | ||
|
||
it "should send to new user" do | ||
expect(mail.to).to eq([@organization.user.email]) | ||
end | ||
|
||
it "should contain welcome subject" do | ||
expect(mail.subject).to eq I18n.t('mailers.welcome_organization.subject') | ||
end | ||
|
||
it "should contain welcome body" do | ||
expect(mail.body).to have_content I18n.t('mailers.welcome_organization.welcome', name: @organization.user.name) | ||
expect(mail.body).to have_content I18n.t('mailers.welcome_organization.text1') | ||
expect(mail.body).to have_content I18n.t('mailers.welcome_organization.text2', email: @organization.user.email, password: @organization.user.password) | ||
expect(mail.body).to have_content I18n.t('mailers.welcome_organization.thanks') | ||
|
||
end | ||
|
||
end | ||
|
||
end |