demarches-normaliennes/spec/controllers/manager/gestionnaires_controller_spec.rb

38 lines
837 B
Ruby
Raw Normal View History

2023-08-29 19:08:27 +02:00
describe Manager::GestionnairesController, type: :controller do
let(:super_admin) { create(:super_admin) }
let(:gestionnaire) { create(:gestionnaire) }
before { sign_in super_admin }
describe '#index' do
render_views
it 'searches admin by email' do
get :index, params: { search: gestionnaire.email }
expect(response).to have_http_status(:success)
end
end
describe '#show' do
render_views
before do
get :show, params: { id: gestionnaire.id }
end
it { expect(response.body).to include(gestionnaire.email) }
end
2023-10-01 12:52:05 +02:00
describe '#delete' do
before { sign_in super_admin }
subject { delete :delete, params: { id: gestionnaire.id } }
it 'deletes the gestionnaire' do
subject
expect(Gestionnaire.find_by(id: gestionnaire.id)).to be_nil
end
end
2023-08-29 19:08:27 +02:00
end