From 018958cad827d7328d80822ac54a85bdaf6a4c66 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Sun, 12 Jun 2022 13:11:51 -0600 Subject: [PATCH 01/18] Added 'send_reactivation_alert' button with corresponding HTTP path routes --- app/views/volunteers/_manage_active.html.erb | 7 ++++++- config/routes.rb | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/volunteers/_manage_active.html.erb b/app/views/volunteers/_manage_active.html.erb index acc000d601..078c7a842a 100644 --- a/app/views/volunteers/_manage_active.html.erb +++ b/app/views/volunteers/_manage_active.html.erb @@ -22,8 +22,13 @@ <% if (current_user.supervisor? || current_user.casa_admin?) && user.invitation_accepted_at.nil? %> - <%= link_to "Resend Invitation", + <%= link_to "Resend Invitation (Email)", resend_invitation_volunteer_path(user), class: "btn btn-outline-danger" %> <% end %> + <% if current_user.casa_admin? %> + <%= link_to "Send Reactivation Alert (SMS)", + send_reactivation_alert_volunteer_path(user), + class: "btn btn-outline-danger" %> + <% end %> diff --git a/config/routes.rb b/config/routes.rb index 8474b1b2a7..2a492856f2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -49,6 +49,7 @@ patch :deactivate patch :activate patch :resend_invitation + post :send_reactivation_alert patch :change_to_supervisor end end @@ -107,6 +108,7 @@ patch :activate patch :deactivate get :resend_invitation + get :send_reactivation_alert patch :reminder get :impersonate end From e4871f2e8c2b508a02785fc40c8385d5a61ed730 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Sun, 12 Jun 2022 13:29:05 -0600 Subject: [PATCH 02/18] Included line break for better-looking button overflow (mobile view) --- app/views/volunteers/_manage_active.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/volunteers/_manage_active.html.erb b/app/views/volunteers/_manage_active.html.erb index 078c7a842a..66f3b8b4a3 100644 --- a/app/views/volunteers/_manage_active.html.erb +++ b/app/views/volunteers/_manage_active.html.erb @@ -1,6 +1,6 @@
<% if user.active? %> - Volunteer is Active + Volunteer is Active
<% if policy(user).deactivate? %> <%= link_to "Deactivate volunteer", deactivate_volunteer_path(user), From c81831078f3ef96f8585e45e48c82add514df656 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Sun, 12 Jun 2022 15:29:24 -0600 Subject: [PATCH 03/18] Permitted Admins to 'send_reactivation_alert' to volunteers (granted them authorization or privilege) --- app/policies/volunteer_policy.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/policies/volunteer_policy.rb b/app/policies/volunteer_policy.rb index 1ca5971784..712d40bcea 100644 --- a/app/policies/volunteer_policy.rb +++ b/app/policies/volunteer_policy.rb @@ -41,5 +41,6 @@ def stop_impersonating? alias_method :activate?, :admin_or_supervisor_same_org? alias_method :deactivate?, :admin_or_supervisor_same_org? alias_method :resend_invitation?, :admin_or_supervisor_same_org? + alias_method :send_reactivation_alert?, :admin_or_supervisor_same_org? alias_method :reminder?, :admin_or_supervisor_same_org? end From 48ca5aed3ead3faabe2db06acd5d2c88214c104c Mon Sep 17 00:00:00 2001 From: 7riumph Date: Sun, 12 Jun 2022 16:43:42 -0600 Subject: [PATCH 04/18] =?UTF-8?q?Added=20volunteer=20and=20casa=20org?= =?UTF-8?q?=E2=80=99s=20phone=20numbers=20under=20private=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/volunteers_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/controllers/volunteers_controller.rb b/app/controllers/volunteers_controller.rb index e8e26ce5a0..4a2810211b 100644 --- a/app/controllers/volunteers_controller.rb +++ b/app/controllers/volunteers_controller.rb @@ -134,4 +134,14 @@ def update_volunteer_params .new(params) .without_active end + + def volunteers_phone_number + authorize @volunteer + @volunteers_phone_number = @volunteer.phone_number + end + + def casa_orgs_twilio_phone_number + authorize @volunteer + @casa_orgs_twilio_phone_number = @volunteer.casa_org.twilio_phone_number + end end From 65b89687ea23be27d42b94b7aabb7bb2b3e618e0 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Sun, 12 Jun 2022 17:23:33 -0600 Subject: [PATCH 05/18] =?UTF-8?q?Created=20=E2=80=98send=5Fsms=5Fto(phone?= =?UTF-8?q?=5Fnumber)=E2=80=99=20(invokes=20Twilio=20API)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/volunteers_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/volunteers_controller.rb b/app/controllers/volunteers_controller.rb index 4a2810211b..9776ed4deb 100644 --- a/app/controllers/volunteers_controller.rb +++ b/app/controllers/volunteers_controller.rb @@ -144,4 +144,10 @@ def casa_orgs_twilio_phone_number authorize @volunteer @casa_orgs_twilio_phone_number = @volunteer.casa_org.twilio_phone_number end + + def send_sms_to(phone_number, body) + twilio = TwilioService.new(api_key = current_user.casa_org.twilio_api_key_sid, api_secret = current_user.casa_org.twilio_api_key_secret, acc_sid = current_user.casa_org.twilio_account_sid) + req_params = {From: casa_orgs_twilio_phone_number, Body: body, To: phone_number} + twilio_res = twilio.send_sms(req_params) + end end From 8366aaffddad603bf8e708c3b168653c94fe145c Mon Sep 17 00:00:00 2001 From: 7riumph Date: Sun, 12 Jun 2022 17:43:17 -0600 Subject: [PATCH 06/18] =?UTF-8?q?Added=20=E2=80=98send=5Freactivation=5Fal?= =?UTF-8?q?ert=E2=80=99=20action=20method=20to=20volunteers=20controller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/volunteers_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/volunteers_controller.rb b/app/controllers/volunteers_controller.rb index 9776ed4deb..913e5df3dd 100644 --- a/app/controllers/volunteers_controller.rb +++ b/app/controllers/volunteers_controller.rb @@ -85,6 +85,14 @@ def resend_invitation end end + def send_reactivation_alert + authorize @volunteer + if @volunteer.save + send_sms_to(volunteers_phone_number, "Hello #{@volunteer.display_name}, \n \n Your CASA/Prince George’s County volunteer console account has been reactivated. You can login using the credentials you were already using. \n \n If you have any questions, please contact your most recent Case Supervisor for assistance. \n \n CASA/Prince George’s County") + redirect_to edit_volunteer_path(@volunteer), notice: "Reactivation alert sent" + end + end + def reminder authorize @volunteer with_cc = params[:with_cc].present? From c14fb16dea59de1c7ca412548b074d865ae55d4c Mon Sep 17 00:00:00 2001 From: 7riumph Date: Sun, 12 Jun 2022 18:02:30 -0600 Subject: [PATCH 07/18] Error handling --- app/controllers/volunteers_controller.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/volunteers_controller.rb b/app/controllers/volunteers_controller.rb index 913e5df3dd..07714acfe2 100644 --- a/app/controllers/volunteers_controller.rb +++ b/app/controllers/volunteers_controller.rb @@ -89,7 +89,9 @@ def send_reactivation_alert authorize @volunteer if @volunteer.save send_sms_to(volunteers_phone_number, "Hello #{@volunteer.display_name}, \n \n Your CASA/Prince George’s County volunteer console account has been reactivated. You can login using the credentials you were already using. \n \n If you have any questions, please contact your most recent Case Supervisor for assistance. \n \n CASA/Prince George’s County") - redirect_to edit_volunteer_path(@volunteer), notice: "Reactivation alert sent" + redirect_to edit_volunteer_path(@volunteer), notice: "Volunteer reactivation alert sent" + else + redirect_to edit_volunteer_path(@volunteer), alert: "Volunteer reactivation alert failed" end end @@ -157,5 +159,12 @@ def send_sms_to(phone_number, body) twilio = TwilioService.new(api_key = current_user.casa_org.twilio_api_key_sid, api_secret = current_user.casa_org.twilio_api_key_secret, acc_sid = current_user.casa_org.twilio_account_sid) req_params = {From: casa_orgs_twilio_phone_number, Body: body, To: phone_number} twilio_res = twilio.send_sms(req_params) + + #Error handling for spec test purposes + if twilio_res.error_code === nil + return "SMS has been sent to Volunteer!" + else + return "SMS was not sent to Volunteer due to an error." + end end end From daf59b0eefafeba28db8d724a205cf2c2e6ef246 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Sun, 12 Jun 2022 18:08:30 -0600 Subject: [PATCH 08/18] Branch clean up (standardrb --fix) --- app/controllers/volunteers_controller.rb | 16 ++++++++-------- config/routes.rb | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/volunteers_controller.rb b/app/controllers/volunteers_controller.rb index 07714acfe2..841c1d7664 100644 --- a/app/controllers/volunteers_controller.rb +++ b/app/controllers/volunteers_controller.rb @@ -93,8 +93,8 @@ def send_reactivation_alert else redirect_to edit_volunteer_path(@volunteer), alert: "Volunteer reactivation alert failed" end - end - + end + def reminder authorize @volunteer with_cc = params[:with_cc].present? @@ -156,15 +156,15 @@ def casa_orgs_twilio_phone_number end def send_sms_to(phone_number, body) - twilio = TwilioService.new(api_key = current_user.casa_org.twilio_api_key_sid, api_secret = current_user.casa_org.twilio_api_key_secret, acc_sid = current_user.casa_org.twilio_account_sid) + twilio = TwilioService.new(current_user.casa_org.twilio_api_key_sid, current_user.casa_org.twilio_api_key_secret, current_user.casa_org.twilio_account_sid) req_params = {From: casa_orgs_twilio_phone_number, Body: body, To: phone_number} twilio_res = twilio.send_sms(req_params) - - #Error handling for spec test purposes - if twilio_res.error_code === nil - return "SMS has been sent to Volunteer!" + + # Error handling for spec test purposes + if twilio_res.error_code.nil? + "SMS has been sent to Volunteer!" else - return "SMS was not sent to Volunteer due to an error." + "SMS was not sent to Volunteer due to an error." end end end diff --git a/config/routes.rb b/config/routes.rb index 2a492856f2..6de42220d3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -49,7 +49,7 @@ patch :deactivate patch :activate patch :resend_invitation - post :send_reactivation_alert + post :send_reactivation_alert patch :change_to_supervisor end end From 1a854659a1ff14e54652e66f4eeb30a6e13e017d Mon Sep 17 00:00:00 2001 From: 7riumph Date: Sun, 12 Jun 2022 18:55:31 -0600 Subject: [PATCH 09/18] Now SMS is send based on Admin's casa_org twilio number --- app/controllers/volunteers_controller.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/controllers/volunteers_controller.rb b/app/controllers/volunteers_controller.rb index 841c1d7664..05db3abc2b 100644 --- a/app/controllers/volunteers_controller.rb +++ b/app/controllers/volunteers_controller.rb @@ -150,14 +150,9 @@ def volunteers_phone_number @volunteers_phone_number = @volunteer.phone_number end - def casa_orgs_twilio_phone_number - authorize @volunteer - @casa_orgs_twilio_phone_number = @volunteer.casa_org.twilio_phone_number - end - def send_sms_to(phone_number, body) twilio = TwilioService.new(current_user.casa_org.twilio_api_key_sid, current_user.casa_org.twilio_api_key_secret, current_user.casa_org.twilio_account_sid) - req_params = {From: casa_orgs_twilio_phone_number, Body: body, To: phone_number} + req_params = {From: current_user.casa_org.twilio_phone_number, Body: body, To: phone_number} twilio_res = twilio.send_sms(req_params) # Error handling for spec test purposes From ad6ff25c74769640c6c63726c805103f9febf7a4 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Tue, 14 Jun 2022 13:03:40 -0600 Subject: [PATCH 10/18] Attempt to fix rspec error --- spec/system/other_duties/new_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/other_duties/new_spec.rb b/spec/system/other_duties/new_spec.rb index 4b01a46525..3ea19fc1ef 100644 --- a/spec/system/other_duties/new_spec.rb +++ b/spec/system/other_duties/new_spec.rb @@ -23,7 +23,7 @@ click_on "Submit" message = page.find("#other_duty_notes").native.attribute("validationMessage") - expect(message).to eq "Please fill out this field." + expect(message).to eq "Please fill in this field." end end end From a4e65c5848c9aa510789dc693244f8e0d5a9b4a6 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Tue, 14 Jun 2022 13:17:20 -0600 Subject: [PATCH 11/18] Rspec failure due to got value changing --- spec/system/other_duties/new_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/other_duties/new_spec.rb b/spec/system/other_duties/new_spec.rb index 3ea19fc1ef..4b01a46525 100644 --- a/spec/system/other_duties/new_spec.rb +++ b/spec/system/other_duties/new_spec.rb @@ -23,7 +23,7 @@ click_on "Submit" message = page.find("#other_duty_notes").native.attribute("validationMessage") - expect(message).to eq "Please fill in this field." + expect(message).to eq "Please fill out this field." end end end From f8104894d23a8df1305cd0d0674a3dc4b178aab0 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Tue, 14 Jun 2022 14:43:42 -0600 Subject: [PATCH 12/18] Confirmed 'send_reactivation_alert_volunteer_path' redirect (SMS is sent/stubbed with redirect) --- app/controllers/volunteers_controller.rb | 2 +- spec/requests/volunteers_spec.rb | 22 ++++++++++++++++++++++ spec/support/webmock_helper.rb | 12 ++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/controllers/volunteers_controller.rb b/app/controllers/volunteers_controller.rb index 05db3abc2b..5a3eab9a4f 100644 --- a/app/controllers/volunteers_controller.rb +++ b/app/controllers/volunteers_controller.rb @@ -88,7 +88,7 @@ def resend_invitation def send_reactivation_alert authorize @volunteer if @volunteer.save - send_sms_to(volunteers_phone_number, "Hello #{@volunteer.display_name}, \n \n Your CASA/Prince George’s County volunteer console account has been reactivated. You can login using the credentials you were already using. \n \n If you have any questions, please contact your most recent Case Supervisor for assistance. \n \n CASA/Prince George’s County") + send_sms_to(volunteers_phone_number, "Hello, \n \n Your CASA/Prince George’s County volunteer console account has been reactivated. You can login using the credentials you were already using. \n \n If you have any questions, please contact your most recent Case Supervisor for assistance. \n \n CASA/Prince George’s County") redirect_to edit_volunteer_path(@volunteer), notice: "Volunteer reactivation alert sent" else redirect_to edit_volunteer_path(@volunteer), alert: "Volunteer reactivation alert failed" diff --git a/spec/requests/volunteers_spec.rb b/spec/requests/volunteers_spec.rb index a8ca19417b..5fd3d79dbf 100644 --- a/spec/requests/volunteers_spec.rb +++ b/spec/requests/volunteers_spec.rb @@ -1,4 +1,5 @@ require "rails_helper" +require "support/webmock_helper" RSpec.describe "/volunteers", type: :request do let(:organization) { create(:casa_org) } @@ -274,6 +275,27 @@ end end + + describe "POST /send_reactivation_alert" do + before do + sign_in admin + + stubbed_requests + WebMock.disable_net_connect! + @acc_sid = "articuno34" + @api_key = "Aladin" + @api_secret = "open sesame" + @short_url = ShortUrlService.new + @twilio = TwilioService.new(@api_key, @api_secret, @acc_sid) + end + + it "sends an reactivation SMS" do + get send_reactivation_alert_volunteer_path(volunteer) + expect(response).to redirect_to(edit_volunteer_path(volunteer)) + expect(response.status).to match 302 + end +end + describe "GET /impersonate" do let!(:other_volunteer) { create(:volunteer, casa_org: organization) } let!(:supervisor) { create(:supervisor, casa_org: organization) } diff --git a/spec/support/webmock_helper.rb b/spec/support/webmock_helper.rb index cbf27457b8..df24ee6e37 100644 --- a/spec/support/webmock_helper.rb +++ b/spec/support/webmock_helper.rb @@ -68,4 +68,16 @@ def stubbed_requests } ) .to_return(body: "{\"error_code\":null, \"status\":\"sent\", \"body\":\"If you have made contact with them in the past 60 days, remember to log it: https://42ni.short.gy/jzTwdF\"}") + stub_request(:post, "https://api.twilio.com/2010-04-01/Accounts//Messages.json"). + with( + body: {"Body"=>"Hello, \n \n Your CASA/Prince George’s County volunteer console account has been reactivated. You can login using the credentials you were already using. \n \n If you have any questions, please contact your most recent Case Supervisor for assistance. \n \n CASA/Prince George’s County", "From"=>nil, "To"=>""}, + headers: { + 'Accept'=>'application/json', + 'Accept-Charset'=>'utf-8', + 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', + 'Authorization'=>'Basic Og==', + 'Content-Type'=>'application/x-www-form-urlencoded', + 'User-Agent'=>'twilio-ruby/5.67.2 (linux x86_64) Ruby/3.1.0' + }). + to_return(status: 200, body: "", headers: {}) end From f2b8101ac318f67bd51b0ef2441a61e5a6de18b5 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Tue, 14 Jun 2022 14:46:30 -0600 Subject: [PATCH 13/18] lint --- spec/requests/volunteers_spec.rb | 37 ++++++++++++++++---------------- spec/support/webmock_helper.rb | 23 ++++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/spec/requests/volunteers_spec.rb b/spec/requests/volunteers_spec.rb index 5fd3d79dbf..51701c2cb3 100644 --- a/spec/requests/volunteers_spec.rb +++ b/spec/requests/volunteers_spec.rb @@ -275,26 +275,25 @@ end end - - describe "POST /send_reactivation_alert" do - before do - sign_in admin - - stubbed_requests - WebMock.disable_net_connect! - @acc_sid = "articuno34" - @api_key = "Aladin" - @api_secret = "open sesame" - @short_url = ShortUrlService.new - @twilio = TwilioService.new(@api_key, @api_secret, @acc_sid) - end - - it "sends an reactivation SMS" do - get send_reactivation_alert_volunteer_path(volunteer) - expect(response).to redirect_to(edit_volunteer_path(volunteer)) - expect(response.status).to match 302 + describe "POST /send_reactivation_alert" do + before do + sign_in admin + + stubbed_requests + WebMock.disable_net_connect! + @acc_sid = "articuno34" + @api_key = "Aladin" + @api_secret = "open sesame" + @short_url = ShortUrlService.new + @twilio = TwilioService.new(@api_key, @api_secret, @acc_sid) + end + + it "sends an reactivation SMS" do + get send_reactivation_alert_volunteer_path(volunteer) + expect(response).to redirect_to(edit_volunteer_path(volunteer)) + expect(response.status).to match 302 + end end -end describe "GET /impersonate" do let!(:other_volunteer) { create(:volunteer, casa_org: organization) } diff --git a/spec/support/webmock_helper.rb b/spec/support/webmock_helper.rb index df24ee6e37..196a5f5a32 100644 --- a/spec/support/webmock_helper.rb +++ b/spec/support/webmock_helper.rb @@ -68,16 +68,17 @@ def stubbed_requests } ) .to_return(body: "{\"error_code\":null, \"status\":\"sent\", \"body\":\"If you have made contact with them in the past 60 days, remember to log it: https://42ni.short.gy/jzTwdF\"}") - stub_request(:post, "https://api.twilio.com/2010-04-01/Accounts//Messages.json"). - with( - body: {"Body"=>"Hello, \n \n Your CASA/Prince George’s County volunteer console account has been reactivated. You can login using the credentials you were already using. \n \n If you have any questions, please contact your most recent Case Supervisor for assistance. \n \n CASA/Prince George’s County", "From"=>nil, "To"=>""}, + stub_request(:post, "https://api.twilio.com/2010-04-01/Accounts//Messages.json") + .with( + body: {"Body" => "Hello, \n \n Your CASA/Prince George’s County volunteer console account has been reactivated. You can login using the credentials you were already using. \n \n If you have any questions, please contact your most recent Case Supervisor for assistance. \n \n CASA/Prince George’s County", "From" => nil, "To" => ""}, headers: { - 'Accept'=>'application/json', - 'Accept-Charset'=>'utf-8', - 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', - 'Authorization'=>'Basic Og==', - 'Content-Type'=>'application/x-www-form-urlencoded', - 'User-Agent'=>'twilio-ruby/5.67.2 (linux x86_64) Ruby/3.1.0' - }). - to_return(status: 200, body: "", headers: {}) + "Accept" => "application/json", + "Accept-Charset" => "utf-8", + "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", + "Authorization" => "Basic Og==", + "Content-Type" => "application/x-www-form-urlencoded", + "User-Agent" => "twilio-ruby/5.67.2 (linux x86_64) Ruby/3.1.0" + } + ) + .to_return(status: 200, body: "", headers: {}) end From 3120088fd1d9491653040db6bcb3c218ae225e0c Mon Sep 17 00:00:00 2001 From: 7riumph Date: Tue, 14 Jun 2022 15:00:10 -0600 Subject: [PATCH 14/18] Fixed stub for non local deploy --- spec/support/webmock_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/webmock_helper.rb b/spec/support/webmock_helper.rb index 196a5f5a32..9be8276830 100644 --- a/spec/support/webmock_helper.rb +++ b/spec/support/webmock_helper.rb @@ -77,7 +77,7 @@ def stubbed_requests "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "Authorization" => "Basic Og==", "Content-Type" => "application/x-www-form-urlencoded", - "User-Agent" => "twilio-ruby/5.67.2 (linux x86_64) Ruby/3.1.0" + "User-Agent" => "twilio-ruby/5.67.2 (linux-musl x86_64) Ruby/3.1.0" } ) .to_return(status: 200, body: "", headers: {}) From a0721749c85ee17cf7cb17f020e01ef5bf656503 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Tue, 14 Jun 2022 17:20:06 -0600 Subject: [PATCH 15/18] ReGex'd request stub to account for volunteer 'display_name' variability --- app/controllers/volunteers_controller.rb | 2 +- spec/requests/volunteers_spec.rb | 6 +++--- spec/support/webmock_helper.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/volunteers_controller.rb b/app/controllers/volunteers_controller.rb index 5a3eab9a4f..05db3abc2b 100644 --- a/app/controllers/volunteers_controller.rb +++ b/app/controllers/volunteers_controller.rb @@ -88,7 +88,7 @@ def resend_invitation def send_reactivation_alert authorize @volunteer if @volunteer.save - send_sms_to(volunteers_phone_number, "Hello, \n \n Your CASA/Prince George’s County volunteer console account has been reactivated. You can login using the credentials you were already using. \n \n If you have any questions, please contact your most recent Case Supervisor for assistance. \n \n CASA/Prince George’s County") + send_sms_to(volunteers_phone_number, "Hello #{@volunteer.display_name}, \n \n Your CASA/Prince George’s County volunteer console account has been reactivated. You can login using the credentials you were already using. \n \n If you have any questions, please contact your most recent Case Supervisor for assistance. \n \n CASA/Prince George’s County") redirect_to edit_volunteer_path(@volunteer), notice: "Volunteer reactivation alert sent" else redirect_to edit_volunteer_path(@volunteer), alert: "Volunteer reactivation alert failed" diff --git a/spec/requests/volunteers_spec.rb b/spec/requests/volunteers_spec.rb index 51701c2cb3..43b9d2a01b 100644 --- a/spec/requests/volunteers_spec.rb +++ b/spec/requests/volunteers_spec.rb @@ -281,9 +281,9 @@ stubbed_requests WebMock.disable_net_connect! - @acc_sid = "articuno34" - @api_key = "Aladin" - @api_secret = "open sesame" + @acc_sid = "fake_twilio_sid" + @api_key = "fake_twilio_api_key" + @api_secret = "fake_twilio_api_secret" @short_url = ShortUrlService.new @twilio = TwilioService.new(@api_key, @api_secret, @acc_sid) end diff --git a/spec/support/webmock_helper.rb b/spec/support/webmock_helper.rb index 9be8276830..6ee8ec80fa 100644 --- a/spec/support/webmock_helper.rb +++ b/spec/support/webmock_helper.rb @@ -70,14 +70,14 @@ def stubbed_requests .to_return(body: "{\"error_code\":null, \"status\":\"sent\", \"body\":\"If you have made contact with them in the past 60 days, remember to log it: https://42ni.short.gy/jzTwdF\"}") stub_request(:post, "https://api.twilio.com/2010-04-01/Accounts//Messages.json") .with( - body: {"Body" => "Hello, \n \n Your CASA/Prince George’s County volunteer console account has been reactivated. You can login using the credentials you were already using. \n \n If you have any questions, please contact your most recent Case Supervisor for assistance. \n \n CASA/Prince George’s County", "From" => nil, "To" => ""}, + body: {"Body" => /volunteer\sconsole\saccount\shas\sbeen\sreactivated/, "From" => nil, "To" => ""}, headers: { "Accept" => "application/json", "Accept-Charset" => "utf-8", "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "Authorization" => "Basic Og==", "Content-Type" => "application/x-www-form-urlencoded", - "User-Agent" => "twilio-ruby/5.67.2 (linux-musl x86_64) Ruby/3.1.0" + "User-Agent" => "twilio-ruby/5.67.2 (linux x86_64) Ruby/3.1.0" } ) .to_return(status: 200, body: "", headers: {}) From d23ba5175cab10e17d0d9e6f5886b8233c516468 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Tue, 14 Jun 2022 18:09:41 -0600 Subject: [PATCH 16/18] Rspec error troubleshoot --- spec/system/other_duties/new_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/other_duties/new_spec.rb b/spec/system/other_duties/new_spec.rb index 4b01a46525..3ea19fc1ef 100644 --- a/spec/system/other_duties/new_spec.rb +++ b/spec/system/other_duties/new_spec.rb @@ -23,7 +23,7 @@ click_on "Submit" message = page.find("#other_duty_notes").native.attribute("validationMessage") - expect(message).to eq "Please fill out this field." + expect(message).to eq "Please fill in this field." end end end From 3452e38ca61c2729d597c35d2ff98097f3ba0a25 Mon Sep 17 00:00:00 2001 From: 7riumph Date: Tue, 14 Jun 2022 18:19:57 -0600 Subject: [PATCH 17/18] Rspec error troubleshoot --- spec/system/other_duties/new_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/other_duties/new_spec.rb b/spec/system/other_duties/new_spec.rb index 3ea19fc1ef..4b01a46525 100644 --- a/spec/system/other_duties/new_spec.rb +++ b/spec/system/other_duties/new_spec.rb @@ -23,7 +23,7 @@ click_on "Submit" message = page.find("#other_duty_notes").native.attribute("validationMessage") - expect(message).to eq "Please fill in this field." + expect(message).to eq "Please fill out this field." end end end From dc71a5e6569943be7a0a34daf24891d34295e90a Mon Sep 17 00:00:00 2001 From: compwron Date: Tue, 14 Jun 2022 18:30:35 -0700 Subject: [PATCH 18/18] lint that the linter doesn't care about --- app/views/volunteers/_manage_active.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/volunteers/_manage_active.html.erb b/app/views/volunteers/_manage_active.html.erb index 66f3b8b4a3..f8388a8d61 100644 --- a/app/views/volunteers/_manage_active.html.erb +++ b/app/views/volunteers/_manage_active.html.erb @@ -27,8 +27,8 @@ class: "btn btn-outline-danger" %> <% end %> <% if current_user.casa_admin? %> - <%= link_to "Send Reactivation Alert (SMS)", - send_reactivation_alert_volunteer_path(user), - class: "btn btn-outline-danger" %> - <% end %> + <%= link_to "Send Reactivation Alert (SMS)", + send_reactivation_alert_volunteer_path(user), + class: "btn btn-outline-danger" %> + <% end %>