Profil: display token only once
This commit is contained in:
parent
bd04972f65
commit
17285b0368
6 changed files with 54 additions and 37 deletions
|
@ -0,0 +1,19 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe NewAdministrateur::ProfilController, type: :controller do
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
|
||||
before { sign_in(administrateur) }
|
||||
|
||||
describe 'POST #renew_api_token' do
|
||||
before do
|
||||
allow(administrateur).to receive(:renew_api_token)
|
||||
allow(controller).to receive(:current_administrateur) { administrateur }
|
||||
post :renew_api_token
|
||||
end
|
||||
|
||||
it { expect(administrateur).to have_received(:renew_api_token) }
|
||||
it { expect(response.status).to render_template(:show) }
|
||||
it { expect(flash.notice).to eq('Votre jeton a été regénéré.') }
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue