tests
This commit is contained in:
parent
c731f8cf1f
commit
0b6c7dace7
1 changed files with 11 additions and 2 deletions
|
@ -354,7 +354,7 @@ describe NewAdministrateur::GroupeInstructeursController, type: :controller do
|
||||||
post :import, params: { procedure_id: procedure.id, group_csv_file: csv_file }
|
post :import, params: { procedure_id: procedure.id, group_csv_file: csv_file }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the csv file is less than 1 mo' do
|
context 'when the csv file is less than 1 mo and content type text/csv' do
|
||||||
let(:csv_file) { fixture_file_upload('spec/fixtures/files/groupe-instructeur.csv', 'text/csv') }
|
let(:csv_file) { fixture_file_upload('spec/fixtures/files/groupe-instructeur.csv', 'text/csv') }
|
||||||
|
|
||||||
before { subject }
|
before { subject }
|
||||||
|
@ -365,6 +365,15 @@ describe NewAdministrateur::GroupeInstructeursController, type: :controller do
|
||||||
it { expect(flash.alert).to eq("Import terminé. Cependant les emails suivants ne sont pas pris en compte: kara") }
|
it { expect(flash.alert).to eq("Import terminé. Cependant les emails suivants ne sont pas pris en compte: kara") }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when the file content type is application/vnd.ms-excel' do
|
||||||
|
let(:csv_file) { fixture_file_upload('spec/fixtures/files/groupe_avec_caracteres_speciaux.csv', "application/vnd.ms-excel") }
|
||||||
|
|
||||||
|
before { subject }
|
||||||
|
|
||||||
|
it { expect(flash.notice).to be_present }
|
||||||
|
it { expect(flash.notice).to eq("La liste des instructeurs a été importée avec succès") }
|
||||||
|
end
|
||||||
|
|
||||||
context 'when the content of csv contains special characters' do
|
context 'when the content of csv contains special characters' do
|
||||||
let(:csv_file) { fixture_file_upload('spec/fixtures/files/groupe_avec_caracteres_speciaux.csv', 'text/csv') }
|
let(:csv_file) { fixture_file_upload('spec/fixtures/files/groupe_avec_caracteres_speciaux.csv', 'text/csv') }
|
||||||
|
|
||||||
|
@ -387,7 +396,7 @@ describe NewAdministrateur::GroupeInstructeursController, type: :controller do
|
||||||
it { expect(flash.alert).to eq("Importation impossible : la poids du fichier est supérieur à 1 Mo") }
|
it { expect(flash.alert).to eq("Importation impossible : la poids du fichier est supérieur à 1 Mo") }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the file is not a csv' do
|
context 'when the file content type is not accepted' do
|
||||||
let(:csv_file) { fixture_file_upload('spec/fixtures/files/french-flag.gif', 'image/gif') }
|
let(:csv_file) { fixture_file_upload('spec/fixtures/files/french-flag.gif', 'image/gif') }
|
||||||
|
|
||||||
before { subject }
|
before { subject }
|
||||||
|
|
Loading…
Add table
Reference in a new issue