policies: fix champ policy for guest users

This commit is contained in:
Pierre de La Morinerie 2020-04-01 16:10:45 +02:00
parent c17ceb4440
commit 059e11601b
2 changed files with 21 additions and 1 deletions

View file

@ -35,6 +35,14 @@ describe ChampPolicy do
it_behaves_like 'they cant access a private champ'
end
context 'as a person invited on the dossier' do
let(:invite) { create(:invite, :with_user, dossier: dossier) }
let(:signed_in_user) { invite.user }
it_behaves_like 'they can access a public champ'
it_behaves_like 'they cant access a private champ'
end
context 'as another user' do
let(:signed_in_user) { create(:user) }