Sha256: 22083740e27d609fb5b10554f7a97e1ea9ce9ee66ccb3532aec9253ae8441005

Contents?: true

Size: 737 Bytes

Versions: 14

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

require "decidim/faker/localized"
require "decidim/dev"

FactoryBot.define do
  factory :template, class: "Decidim::Templates::Template" do
    organization
    templatable { build(:dummy_resource) }
    name { Decidim::Faker::Localized.sentence }

    ## Questionnaire templates
    factory :questionnaire_template do
      trait :with_questions do
        after(:create) do |template|
          template.templatable = create(:questionnaire, :with_questions, questionnaire_for: template)
          template.save!
        end
      end

      after(:create) do |template|
        template.templatable = create(:questionnaire, questionnaire_for: template)
        template.save!
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
decidim-templates-0.24.3 lib/decidim/templates/test/factories.rb
decidim-templates-0.23.6 lib/decidim/templates/test/factories.rb
decidim-templates-0.24.2 lib/decidim/templates/test/factories.rb
decidim-templates-0.23.5 lib/decidim/templates/test/factories.rb
decidim-templates-0.24.1 lib/decidim/templates/test/factories.rb
decidim-templates-0.24.0 lib/decidim/templates/test/factories.rb
decidim-templates-0.24.0.rc2 lib/decidim/templates/test/factories.rb
decidim-templates-0.23.4 lib/decidim/templates/test/factories.rb
decidim-templates-0.24.0.rc1 lib/decidim/templates/test/factories.rb
decidim-templates-0.23.3 lib/decidim/templates/test/factories.rb
decidim-templates-0.23.2 lib/decidim/templates/test/factories.rb
decidim-templates-0.23.1 lib/decidim/templates/test/factories.rb
decidim-templates-0.23.1.rc1 lib/decidim/templates/test/factories.rb
decidim-templates-0.23.0 lib/decidim/templates/test/factories.rb