From 5e871fc71e217acd56367786a23fb3d54bd2e290 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 11 Mar 2026 15:30:39 +1100 Subject: [PATCH] Expect UI change before emails Fixing a flaky spec. --- spec/system/admin/enterprises_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/system/admin/enterprises_spec.rb b/spec/system/admin/enterprises_spec.rb index e831695c51..2b7e598a4e 100644 --- a/spec/system/admin/enterprises_spec.rb +++ b/spec/system/admin/enterprises_spec.rb @@ -664,16 +664,16 @@ RSpec.describe ' end it "finally, can invite unregistered users" do - within ".reveal-modal" do - tomselect_fill_in "user_invitation[email]", with: "email@email.com" + expect do + within ".reveal-modal" do + tomselect_fill_in "user_invitation[email]", with: "email@email.com" - expect do click_button "Invite" - end.to enqueue_job(ActionMailer::MailDeliveryJob).exactly(:twice) - end + end - expect(page) - .to have_content "email@email.com has been invited to manage this enterprise" + expect(page) + .to have_content "email@email.com has been invited to manage this enterprise" + end.to enqueue_job(ActionMailer::MailDeliveryJob).exactly(:twice) end end end