Sha256: 78a1680b9984d4f11c943e2eff707ea89217eb7c0f8330a76b40a2743b7eef78

Contents?: true

Size: 1.23 KB

Versions: 12

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require "decidim/core/test/factories"
require "decidim/admin/test/factories"

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

12 entries across 12 versions & 2 rubygems

Version Path
decidim-surveys-0.4.2 lib/decidim/surveys/test/factories.rb
decidim-surveys-0.4.1 lib/decidim/surveys/test/factories.rb
decidim-0.4.2 decidim-surveys/lib/decidim/surveys/test/factories.rb
decidim-0.4.1 decidim-surveys/lib/decidim/surveys/test/factories.rb
decidim-surveys-0.4.0 lib/decidim/surveys/test/factories.rb
decidim-0.4.0 decidim-surveys/lib/decidim/surveys/test/factories.rb
decidim-surveys-0.3.2 lib/decidim/surveys/test/factories.rb
decidim-0.3.2 decidim-surveys/lib/decidim/surveys/test/factories.rb
decidim-surveys-0.3.1 lib/decidim/surveys/test/factories.rb
decidim-0.3.1 decidim-surveys/lib/decidim/surveys/test/factories.rb
decidim-surveys-0.3.0 lib/decidim/surveys/test/factories.rb
decidim-0.3.0 decidim-surveys/lib/decidim/surveys/test/factories.rb