-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix-l-affichage-des-evaluations
- Loading branch information
Showing
11 changed files
with
207 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
describe EvenementQuestion, type: :model do | ||
describe '.prises_en_compte_pour_calcul_score_clea(questions_repondues)' do | ||
let(:question_n1) { build(:question, :numeratie_niveau1, score: 1) } | ||
let(:question_rattrapage_n1) { build(:question, :numeratie_niveau1_rattrapage, score: 1) } | ||
|
||
let(:evenements_questions) { [] } | ||
|
||
let(:resultat) do | ||
described_class.prises_en_compte_pour_calcul_score_clea(evenements_questions) | ||
end | ||
|
||
context 'quand les questions sont pour la litteratie' do | ||
it "retourne l'ensemble des questions" do | ||
expect(resultat).to eq evenements_questions | ||
end | ||
end | ||
|
||
context "quand il n'y a pas de rattrapage dans les questions répondues" do | ||
let(:evenement_question_n1) do | ||
described_class.new(question: question_n1, | ||
evenement: build(:evenement, | ||
donnees: { score: 1, | ||
question: question_n1.nom_technique })) | ||
end | ||
let(:evenement_question_n1_rattrapage) do | ||
described_class.new(question: question_rattrapage_n1) | ||
end | ||
let(:evenements_questions) { [evenement_question_n1, evenement_question_n1_rattrapage] } | ||
|
||
it 'ne retourne pas les questions de rattrapage' do | ||
expect(resultat).not_to include(evenement_question_n1_rattrapage) | ||
expect(evenements_questions.size).to eq 2 | ||
end | ||
end | ||
|
||
context 'quand il y a une question principale échouée' do | ||
let(:evenement_question_n1) do | ||
described_class.new(question: question_n1, | ||
evenement: build(:evenement, | ||
donnees: { score: 0, | ||
question: question_n1.nom_technique })) | ||
end | ||
let(:evenement_question_n1_rattrapage) do | ||
described_class.new(question: question_rattrapage_n1) | ||
end | ||
let(:evenements_questions) { [evenement_question_n1, evenement_question_n1_rattrapage] } | ||
|
||
it 'retourne les questions de rattrapage N1Rrn' do | ||
expect(resultat).to include(evenement_question_n1_rattrapage) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
describe ImportExport::OngletXls do | ||
describe '#set_nombre(ligne, colonne, valeur)' do | ||
let(:onglet_xls) do | ||
entetes = [{ titre: 'Mon titre', taille: 20 }] | ||
workbook = Spreadsheet::Workbook.new | ||
described_class.new(ImportExport::ExportXls::WORKSHEET_DONNEES, workbook, entetes) | ||
end | ||
|
||
context 'quand le nombre est un entier' do | ||
let(:valeur) { 1 } | ||
|
||
it 'utilise un format de nombre entier' do | ||
ligne = 1 | ||
colonne = 0 | ||
|
||
expect(onglet_xls).to receive(:set_format_colonne).with( | ||
ligne, | ||
colonne, | ||
ImportExport::OngletXls::NUMBER_FORMAT | ||
) | ||
|
||
onglet_xls.set_nombre(ligne, colonne, valeur) | ||
end | ||
end | ||
|
||
context 'quand le nombre est un décimal' do | ||
let(:valeur) { 0.5 } | ||
|
||
it 'utilise un format de nombre décimal' do | ||
ligne = 1 | ||
colonne = 0 | ||
|
||
expect(onglet_xls).to receive(:set_format_colonne).with( | ||
ligne, | ||
colonne, | ||
ImportExport::OngletXls::DECIMAL_NUMBER_FORMAT | ||
) | ||
|
||
onglet_xls.set_nombre(ligne, colonne, valeur) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.