Sha256: bcc2b1e1928bac8a023552b1be3298335f1845cbeab5b1143920d0a16b940f22

Contents?: true

Size: 1.67 KB

Versions: 4

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true

FactoryBot.define do
  factory :debate, class: "Decidim::Debates::Debate" do
    title { Decidim::Faker::Localized.sentence(3) }
    description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
    information_updates { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
    instructions { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
    start_time { 1.day.from_now }
    end_time { start_time.advance(hours: 2) }
    component { build(:component, manifest_name: "debates") }

    trait :open_ama do
      start_time { 1.day.ago }
      end_time { 1.day.from_now }
    end

    trait :with_author do
      author do
        build(:user, organization: component.organization) if component
      end
    end

    trait :with_user_group_author do
      author do
        build(:user, organization: component.organization) if component
      end
      user_group do
        build(:user_group, :verified, organization: component.organization, users: [author]) if component
      end
    end
  end

  factory :debates_component, parent: :component do
    name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :debates).i18n_name }
    manifest_name { :debates }
    participatory_space { create(:participatory_process, :with_steps, organization: organization) }
    settings do
      {
        comments_enabled: true
      }
    end

    trait :with_creation_enabled do
      step_settings do
        {
          participatory_space.active_step.id => { creation_enabled: true }
        }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-debates-0.14.4 lib/decidim/debates/test/factories.rb
decidim-debates-0.14.3 lib/decidim/debates/test/factories.rb
decidim-debates-0.14.2 lib/decidim/debates/test/factories.rb
decidim-debates-0.14.1 lib/decidim/debates/test/factories.rb