From 582ab95f5491d76d693fff6bfb7a0357042be0e0 Mon Sep 17 00:00:00 2001 From: Ben Abraham <16797406+Kizr@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:10:06 +0100 Subject: [PATCH] Amend spec logic to avoid repeated subject call --- .../partnerships/notify/create_spec.rb | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/spec/services/placements/partnerships/notify/create_spec.rb b/spec/services/placements/partnerships/notify/create_spec.rb index 289bedbe95..daf8002aad 100644 --- a/spec/services/placements/partnerships/notify/create_spec.rb +++ b/spec/services/placements/partnerships/notify/create_spec.rb @@ -68,18 +68,14 @@ end it "does not send a notification email to users not belonging to the placements service" do - expect { partnership_notify_creation }.not_to have_enqueued_mail( - Placements::SchoolUserMailer, - :partnership_created_notification, - ).with( - user_3, provider, school - ) - expect { partnership_notify_creation }.not_to have_enqueued_mail( - Placements::ProviderUserMailer, - :partnership_created_notification, - ).with( - user_3, provider, school - ) + %i[SchoolUserMailer ProviderUserMailer].each do |mailer_class| + expect { partnership_notify_creation }.not_to have_enqueued_mail( + "Placements::#{mailer_class}".constantize, + :partnership_created_notification, + ).with( + user_3, provider, school + ) + end end end end