decidim-surveys/lib/decidim/surveys/feature.rb in decidim-0.4.3 vs decidim-surveys/lib/decidim/surveys/feature.rb in decidim-0.4.4

- old
+ new

@@ -65,37 +65,33 @@ end exports.serializer Decidim::Surveys::SurveyUserAnswersSerializer end - feature.seeds do - Decidim::ParticipatoryProcess.find_each do |process| - next unless process.steps.any? + feature.seeds do |process| + feature = Decidim::Feature.create!( + name: Decidim::Features::Namer.new(process.organization.available_locales, :surveys).i18n_name, + manifest_name: :surveys, + published_at: Time.current, + participatory_process: process + ) - feature = Decidim::Feature.create!( - name: Decidim::Features::Namer.new(process.organization.available_locales, :surveys).i18n_name, - manifest_name: :surveys, - published_at: Time.current, - participatory_process: process - ) + survey = Decidim::Surveys::Survey.create!( + feature: feature, + title: Decidim::Faker::Localized.paragraph, + description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do + Decidim::Faker::Localized.paragraph(3) + end, + tos: Decidim::Faker::Localized.wrapped("<p>", "</p>") do + Decidim::Faker::Localized.paragraph(2) + end + ) - survey = Decidim::Surveys::Survey.create!( - feature: feature, - title: Decidim::Faker::Localized.paragraph, - description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do - Decidim::Faker::Localized.paragraph(3) - end, - tos: Decidim::Faker::Localized.wrapped("<p>", "</p>") do - Decidim::Faker::Localized.paragraph(2) - end + 3.times do + Decidim::Surveys::SurveyQuestion.create!( + survey: survey, + body: Decidim::Faker::Localized.paragraph, + question_type: "short_answer" ) - - 3.times do - Decidim::Surveys::SurveyQuestion.create!( - survey: survey, - body: Decidim::Faker::Localized.paragraph, - question_type: "short_answer" - ) - end end end end