From 10213d88a09a554057d2434b5cecbb40b11e88c3 Mon Sep 17 00:00:00 2001 From: stephanie rousset Date: Tue, 29 Oct 2024 09:11:00 +0100 Subject: [PATCH] refactor: update test --- .../decidim/forms/user_answers_serializer_spec.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/spec/serializers/decidim/forms/user_answers_serializer_spec.rb b/spec/serializers/decidim/forms/user_answers_serializer_spec.rb index e11c716229..6badfad42e 100644 --- a/spec/serializers/decidim/forms/user_answers_serializer_spec.rb +++ b/spec/serializers/decidim/forms/user_answers_serializer_spec.rb @@ -67,7 +67,6 @@ module Forms end describe "#serialize" do - let(:serialized) { subject.serialize } it "includes the answer for each question" do @@ -87,7 +86,7 @@ module Forms end serialized_files_answer = files_answer.attachments.map(&:url) - + expect(serialized).to include( "#{multichoice_question.position + 1}. #{translated(multichoice_question.body, locale: I18n.locale)}" => [multichoice_answer_choices.first.body, multichoice_answer_choices.last.body] ) @@ -103,7 +102,6 @@ module Forms expect(serialized).to include( "#{files_question.position + 1}. #{translated(files_question.body, locale: I18n.locale)}" => serialized_files_answer ) - end context "and includes the attributes" do @@ -213,10 +211,9 @@ def memory_usage 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{|q| q.position}.map{|question| question.position + 1}) + 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