|
|
|
@ -69,19 +69,16 @@ describe InvitesController do
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe 'DELETE #create' do
|
|
|
|
|
let(:invite) { Fabricate(:invite, user: user, expires_at: nil) }
|
|
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
delete :destroy, params: { id: invite.id }
|
|
|
|
|
end
|
|
|
|
|
describe 'DELETE #destroy' do
|
|
|
|
|
subject { delete :destroy, params: { id: invite.id } }
|
|
|
|
|
|
|
|
|
|
it 'redirects' do
|
|
|
|
|
expect(response).to redirect_to invites_path
|
|
|
|
|
end
|
|
|
|
|
let(:invite) { Fabricate(:invite, user: user, expires_at: nil) }
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|