Sha256: 52a86b039a6d45572fbabafd61a2439c7d6caee966f0ece35deb3f9d1b68ad75
Contents?: true
Size: 992 Bytes
Versions: 19
Compression:
Stored size: 992 Bytes
Contents
# frozen_string_literal: true require "spec_helper" module Decidim module Surveys describe SurveyUserAnswersSerializer do let!(:survey) { create(:survey) } let!(:user) { create(:user, organization: survey.feature.organization) } let!(:survey_questions) { create_list :survey_question, 3, survey: survey } let!(:survey_answers) do survey_questions.map do |question| create :survey_answer, survey: survey, question: question, user: user end end subject do described_class.new(survey_answers) end describe "#serialize" do let(:serialized) { subject.serialize } it "includes the answer for each question" do survey_questions.each_with_index do |question, idx| expect(serialized).to include( "#{idx + 1}. #{translated(question.body, locale: I18n.locale)}" => survey_answers[idx].body ) end end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems