From 8f3c91fc3c8ff4b150b171c7b3287a8b65e6dd07 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 27 Feb 2024 11:25:58 -0500 Subject: [PATCH] Add `change` block expectation to `admin/invites#deactivate_all` spec (#29412) --- spec/controllers/admin/invites_controller_spec.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/spec/controllers/admin/invites_controller_spec.rb b/spec/controllers/admin/invites_controller_spec.rb index c8f566f68b..71748cbbec 100644 --- a/spec/controllers/admin/invites_controller_spec.rb +++ b/spec/controllers/admin/invites_controller_spec.rb @@ -44,14 +44,13 @@ describe Admin::InvitesController do end describe 'POST #deactivate_all' do + before { Fabricate(:invite, expires_at: nil) } + it 'expires all invites, then redirects to admin_invites_path' do - invites = Fabricate.times(1, :invite, expires_at: nil) - - post :deactivate_all - - invites.each do |invite| - expect(invite.reload).to be_expired - end + expect { post :deactivate_all } + .to change { Invite.exists?(expires_at: nil) } + .from(true) + .to(false) expect(response).to redirect_to admin_invites_path end