2016-02-05 17:40:58 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
describe 'admin/instructeurs/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
|
2019-08-06 11:02:54 +02:00
|
|
|
assign(:instructeurs, (smart_listing_create :instructeurs,
|
|
|
|
admin.instructeurs,
|
|
|
|
partial: "admin/instructeurs/list",
|
2017-06-12 13:49:51 +02:00
|
|
|
array: true))
|
2019-08-06 11:02:54 +02:00
|
|
|
assign(:instructeur, Instructeur.new())
|
2016-02-05 17:40:58 +01:00
|
|
|
end
|
|
|
|
|
2019-08-06 11:02:54 +02:00
|
|
|
context 'Aucun instructeur' do
|
2016-02-05 17:40:58 +01:00
|
|
|
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
|
2019-08-06 11:02:54 +02:00
|
|
|
create(:instructeur, administrateurs: [admin])
|
2016-02-05 17:40:58 +01:00
|
|
|
admin.reload
|
2019-08-06 11:02:54 +02:00
|
|
|
assign(:instructeurs, (smart_listing_create :instructeurs,
|
|
|
|
admin.instructeurs,
|
|
|
|
partial: "admin/instructeurs/list",
|
2017-06-12 13:49:51 +02:00
|
|
|
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
|