Merge pull request #5374 from betagouv/3451-revoquer-invite

usager: revoque un invité sur un dossier
This commit is contained in:
krichtof 2020-07-15 15:46:16 +02:00 committed by GitHub
commit 0c924be222
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 54 additions and 4 deletions

View file

@ -249,4 +249,30 @@ describe InvitesController, type: :controller do
end
end
end
describe '#DELETE destroy' do
let!(:invite) { create :invite, email: email, dossier: dossier }
let(:signed_in_profile) { dossier.user }
before do
sign_in signed_in_profile
end
subject { delete :destroy, params: { id: invite.id } }
context 'when user is signed in' do
it "destroy invites" do
expect { subject }.to change { Invite.count }.from(1).to(0)
end
end
context 'when dossier does not belong to user' do
let(:another_user) { create(:user) }
it 'does not destroy invite' do
sign_in another_user
expect { subject }.not_to change { Invite.count }
end
end
end
end