demarches-normaliennes/spec/controllers/administrateurs/activate_controller_spec.rb

21 lines
598 B
Ruby
Raw Normal View History

2018-10-30 18:24:29 +01:00
describe Administrateurs::ActivateController, type: :controller do
describe '#new' do
let(:admin) { create(:administrateur) }
2019-08-09 11:41:36 +02:00
let(:token) { admin.user.send(:set_reset_password_token) }
2018-10-30 18:24:29 +01:00
before { allow(controller).to receive(:trust_device) }
context 'when the token is ok' do
before { get :new, params: { token: token } }
it { expect(controller).to have_received(:trust_device) }
end
context 'when the token is bad' do
before { get :new, params: { token: 'bad' } }
it { expect(controller).not_to have_received(:trust_device) }
end
end
end