From 73d53827ea3ef1605f97f99bf3cbeeccb30638be Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 12 Jul 2024 04:19:15 -0400 Subject: [PATCH] Add change assertion to invites destroy spec (#31004) --- spec/controllers/invites_controller_spec.rb | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb index 3190c82884..5221941267 100644 --- a/spec/controllers/invites_controller_spec.rb +++ b/spec/controllers/invites_controller_spec.rb @@ -69,19 +69,16 @@ describe InvitesController do end end - describe 'DELETE #create' do + describe 'DELETE #destroy' do + subject { delete :destroy, params: { id: invite.id } } + let(:invite) { Fabricate(:invite, user: user, expires_at: nil) } - before do - delete :destroy, params: { id: invite.id } - end - - it 'redirects' do - expect(response).to redirect_to invites_path - end - - it 'expires invite' do - expect(invite.reload).to be_expired + it 'expires invite and redirects' do + expect { subject } + .to(change { invite.reload.expired? }.to(true)) + expect(response) + .to redirect_to invites_path end end end