Sha256: 4f07f333988937d0109ecbccfe30470eed4302e07f195b39d5897855632e5791

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

FactoryGirl.define do
  factory :surveys_feature, parent: :feature do
    name { Decidim::Features::Namer.new(participatory_process.organization.available_locales, :surveys).i18n_name }
    manifest_name :surveys
    participatory_process { create(:participatory_process, :with_steps) }
  end

  factory :survey, class: Decidim::Surveys::Survey do
    title { Decidim::Faker::Localized.sentence }
    description do
      Decidim::Faker::Localized.wrapped("<p>", "</p>") do
        Decidim::Faker::Localized.sentence(4)
      end
    end
    tos { Decidim::Faker::Localized.sentence(4) }
    feature { build(:surveys_feature) }
  end

  factory :survey_question, class: Decidim::Surveys::SurveyQuestion do
    body { Decidim::Faker::Localized.sentence }
    mandatory false
    position 0
    question_type Decidim::Surveys::SurveyQuestion::TYPES.first
    answer_options []
    survey
  end

  factory :survey_answer, class: Decidim::Surveys::SurveyAnswer do
    body { Decidim::Faker::Localized.sentence }
    survey
    question { create(:survey_question, survey: survey) }
    user { create(:user, organization: survey.organization) }
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
decidim-surveys-0.5.1 lib/decidim/surveys/test/factories.rb
decidim-0.5.1 decidim-surveys/lib/decidim/surveys/test/factories.rb
decidim-surveys-0.5.0 lib/decidim/surveys/test/factories.rb
decidim-0.5.0 decidim-surveys/lib/decidim/surveys/test/factories.rb
decidim-surveys-0.4.4 lib/decidim/surveys/test/factories.rb
decidim-0.4.4 decidim-surveys/lib/decidim/surveys/test/factories.rb
decidim-surveys-0.4.3 lib/decidim/surveys/test/factories.rb
decidim-0.4.3 decidim-surveys/lib/decidim/surveys/test/factories.rb