do not display the action for instructeur

This commit is contained in:
simon lehericey 2021-09-20 13:57:55 +02:00
parent 75481a644c
commit a7ec77f0a8
2 changed files with 32 additions and 18 deletions

View file

@ -6,15 +6,29 @@ describe Users::ProfilController, type: :controller do
before { sign_in(user) }
describe 'GET #show' do
let(:dossiers) { Array.new(3) { create(:dossier, user: user) } }
let(:next_owner) { 'loulou@lou.com' }
let!(:transfer) { DossierTransfer.initiate(next_owner, dossiers) }
render_views
before { post :show }
it { expect(response.body).to include(I18n.t('users.profil.show.one_waiting_transfer', count: dossiers.count, email: next_owner)) }
context 'when the current user is not an instructeur' do
it { expect(response.body).to include(I18n.t('users.profil.show.transfer_title')) }
context 'when an existing transfer exists' do
let(:dossiers) { Array.new(3) { create(:dossier, user: user) } }
let(:next_owner) { 'loulou@lou.com' }
let!(:transfer) { DossierTransfer.initiate(next_owner, dossiers) }
before { post :show }
it { expect(response.body).to include(I18n.t('users.profil.show.one_waiting_transfer', count: dossiers.count, email: next_owner)) }
end
end
context 'when the current user is an instructeur' do
let(:user) { create(:instructeur).user }
it { expect(response.body).not_to include(I18n.t('users.profil.show.transfer_title')) }
end
end
describe 'POST #renew_api_token' do