Skip to content

Commit

Permalink
🐛 Fix erreur rollbar sur bonne-reponses saisie
Browse files Browse the repository at this point in the history
  • Loading branch information
marouria committed Nov 22, 2024
1 parent 4faedd6 commit 9a5775b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/question_saisie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def as_json(_options = nil)
end

def bonnes_reponses
choix.where(type_choix: :bon)&.pluck(:intitule)&.join(' | ')
reponses.where(type_choix: :bon)&.pluck(:intitule)&.join(' | ')
end

private
Expand Down
7 changes: 7 additions & 0 deletions spec/models/question_saisie_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
categorie: :modalite_reponse)
end
let!(:reponse) { create(:choix, :bon, question_id: question_saisie.id) }
let!(:reponse2) { create(:choix, :bon, question_id: question_saisie.id) }
let(:json) { question_saisie.as_json }

before do
Expand Down Expand Up @@ -54,5 +55,11 @@
expect(json['reponse']).to be_nil
end
end

describe '#bonnes_reponses' do
it 'retourne les bonnes réponses' do
expect(question_saisie.bonnes_reponses).to eql('bon choix | bon choix')
end
end
end
end

0 comments on commit 9a5775b

Please sign in to comment.