From 02fa2ee01556f6ab842d0f9635e137228972e4c3 Mon Sep 17 00:00:00 2001 From: Libby Rodriguez Date: Fri, 18 Jun 2021 12:41:08 -0500 Subject: [PATCH 1/2] Refactor inline styles for casa_admin_mailer/account_setup --- .../casa_admin_mailer/account_setup.html.erb | 47 +++++++++++++++---- .../previews/casa_admin_mailer_preview.rb | 5 ++ spec/mailers/casa_admin_mailer_spec.rb | 22 +++++++++ 3 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 lib/mailers/previews/casa_admin_mailer_preview.rb create mode 100644 spec/mailers/casa_admin_mailer_spec.rb diff --git a/app/views/casa_admin_mailer/account_setup.html.erb b/app/views/casa_admin_mailer/account_setup.html.erb index 7b8061f0ab..93ecb5b525 100644 --- a/app/views/casa_admin_mailer/account_setup.html.erb +++ b/app/views/casa_admin_mailer/account_setup.html.erb @@ -1,22 +1,49 @@ - - - -
+ + + + + - - + - - + diff --git a/lib/mailers/previews/casa_admin_mailer_preview.rb b/lib/mailers/previews/casa_admin_mailer_preview.rb new file mode 100644 index 0000000000..8f76d06146 --- /dev/null +++ b/lib/mailers/previews/casa_admin_mailer_preview.rb @@ -0,0 +1,5 @@ +class CasaAdminMailerPreview < ActionMailer::Preview + def account_setup + CasaAdminMailer.account_setup(CasaAdmin.last) + end +end diff --git a/spec/mailers/casa_admin_mailer_spec.rb b/spec/mailers/casa_admin_mailer_spec.rb new file mode 100644 index 0000000000..4d9884a755 --- /dev/null +++ b/spec/mailers/casa_admin_mailer_spec.rb @@ -0,0 +1,22 @@ +require "rails_helper" + +RSpec.describe CasaAdminMailer, type: :mailer do + let(:casa_admin) { create(:casa_admin) } + + describe ".account_setup" do + let(:mail) { CasaAdminMailer.account_setup(casa_admin) } + + it "sends an email saying the account has been created" do + expect(mail.body.encoded).to match("A #{casa_admin.casa_org.display_name}’s County Admin account") + expect(mail.body.encoded).to match("has been created for you") + end + + it "generates a password reset token and sends email" do + expect(casa_admin.reset_password_token).to be_nil + expect(casa_admin.reset_password_sent_at).to be_nil + expect(mail.body.encoded.squish).to match("Set Your Password") + expect(casa_admin.reset_password_token).to_not be_nil + expect(casa_admin.reset_password_sent_at).to_not be_nil + end + end +end From 12e0783693d50d4b99eeeb7fffc57a9338c1b2a3 Mon Sep 17 00:00:00 2001 From: Libby Rodriguez Date: Sat, 19 Jun 2021 10:54:55 -0500 Subject: [PATCH 2/2] remove style attributes --- app/views/casa_admin_mailer/account_setup.html.erb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/views/casa_admin_mailer/account_setup.html.erb b/app/views/casa_admin_mailer/account_setup.html.erb index 93ecb5b525..89fcdf274a 100644 --- a/app/views/casa_admin_mailer/account_setup.html.erb +++ b/app/views/casa_admin_mailer/account_setup.html.erb @@ -5,8 +5,14 @@ font-size: 14px; margin: 0; } + .account-setup table { + width: 100%; + } .account-setup td { padding: 0 0 20px; + border-spacing: 0; + border-collapse: separate; + vertical-align: top; } .account-setup a { color: #FFF; @@ -25,22 +31,22 @@ } - + - - -