diff --git a/decidim-forms/spec/serializers/decidim/forms/user_answers_serializer_spec.rb b/decidim-forms/spec/serializers/decidim/forms/user_answers_serializer_spec.rb index cc3b00849e21..ac7f03526841 100644 --- a/decidim-forms/spec/serializers/decidim/forms/user_answers_serializer_spec.rb +++ b/decidim-forms/spec/serializers/decidim/forms/user_answers_serializer_spec.rb @@ -219,6 +219,13 @@ def memory_usage end end end + + describe "questions_hash" do + it "generates a hash of questions ordered by position" do + questions.shuffle! + expect(subject.instance_eval { questions_hash }.keys.map { |key| key[0].to_i }.uniq).to eq(questions.sort_by(&:position).map { |question| question.position + 1 }) + end + end end end end