Add change assertion to invites destroy spec (#31004)
parent
bb702e6b20
commit
73d53827ea
|
@ -69,19 +69,16 @@ describe InvitesController do
|
||||||
end
|
end
|
||||||
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) }
|
let(:invite) { Fabricate(:invite, user: user, expires_at: nil) }
|
||||||
|
|
||||||
before do
|
it 'expires invite and redirects' do
|
||||||
delete :destroy, params: { id: invite.id }
|
expect { subject }
|
||||||
end
|
.to(change { invite.reload.expired? }.to(true))
|
||||||
|
expect(response)
|
||||||
it 'redirects' do
|
.to redirect_to invites_path
|
||||||
expect(response).to redirect_to invites_path
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'expires invite' do
|
|
||||||
expect(invite.reload).to be_expired
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue