demarches-normaliennes/spec/views/admin/gestionnaires/index.html.haml_spec.rb

35 lines
923 B
Ruby
Raw Normal View History

2016-02-05 17:40:58 +01:00
require 'spec_helper'
describe 'admin/gestionnaires/index.html.haml', type: :view do
let(:token) { 'super_token' }
let(:admin) { create(:administrateur, api_token: token) }
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
it { expect(rendered).to have_content('Aucun accompagnateur') }
2016-02-05 17:40:58 +01:00
end
context 'Ajout d\'un accompagnateur' do
2016-02-05 17:40:58 +01:00
before do
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