2016-02-05 17:40:58 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'admin/gestionnaires/index.html.haml', type: :view do
|
2018-09-26 17:22:36 +02:00
|
|
|
let(:admin) { create(:administrateur) }
|
2016-02-05 17:40:58 +01:00
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:gestionnaires, (smart_listing_create :gestionnaires,
|
2017-06-12 13:49:51 +02:00
|
|
|
admin.gestionnaires,
|
|
|
|
partial: "admin/gestionnaires/list",
|
|
|
|
array: true))
|
2016-02-05 17:40:58 +01:00
|
|
|
assign(:gestionnaire, Gestionnaire.new())
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'Aucun gestionnaire' do
|
|
|
|
before do
|
|
|
|
render
|
|
|
|
end
|
2018-08-29 22:11:38 +02:00
|
|
|
it { expect(rendered).to have_content('Aucun instructeur') }
|
2016-02-05 17:40:58 +01:00
|
|
|
end
|
|
|
|
|
2018-08-29 22:11:38 +02:00
|
|
|
context 'Ajout d\'un instructeur' do
|
2016-02-05 17:40:58 +01:00
|
|
|
before do
|
2016-05-20 15:39:17 +02:00
|
|
|
create(:gestionnaire, administrateurs: [admin])
|
2016-02-05 17:40:58 +01:00
|
|
|
admin.reload
|
|
|
|
assign(:gestionnaires, (smart_listing_create :gestionnaires,
|
2017-06-12 13:49:51 +02:00
|
|
|
admin.gestionnaires,
|
|
|
|
partial: "admin/gestionnaires/list",
|
|
|
|
array: true))
|
2016-02-05 17:40:58 +01:00
|
|
|
render
|
|
|
|
end
|
2017-06-01 17:44:56 +02:00
|
|
|
it { expect(rendered).to match(/gest\d+@gest.com/) }
|
2016-02-05 17:40:58 +01:00
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|