Add `change` block expectation to `admin/invites#deactivate_all` spec (#29412)
This commit is contained in:
parent
ea8e7f3e9d
commit
8f3c91fc3c
|
@ -44,14 +44,13 @@ describe Admin::InvitesController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #deactivate_all' do
|
describe 'POST #deactivate_all' do
|
||||||
|
before { Fabricate(:invite, expires_at: nil) }
|
||||||
|
|
||||||
it 'expires all invites, then redirects to admin_invites_path' do
|
it 'expires all invites, then redirects to admin_invites_path' do
|
||||||
invites = Fabricate.times(1, :invite, expires_at: nil)
|
expect { post :deactivate_all }
|
||||||
|
.to change { Invite.exists?(expires_at: nil) }
|
||||||
post :deactivate_all
|
.from(true)
|
||||||
|
.to(false)
|
||||||
invites.each do |invite|
|
|
||||||
expect(invite.reload).to be_expired
|
|
||||||
end
|
|
||||||
|
|
||||||
expect(response).to redirect_to admin_invites_path
|
expect(response).to redirect_to admin_invites_path
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue