Sha256: a253df4b16501920bd859ee089f427f5671f8217cac4da2341ca0ac9c02f84aa

Contents?: true

Size: 1.65 KB

Versions: 6

Compression:

Stored size: 1.65 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) }
    feature { build(:feature, 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: feature.organization) if feature
      end
    end

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

  factory :debates_feature, parent: :feature do
    name { Decidim::Features::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

6 entries across 6 versions & 1 rubygems

Version Path
decidim-debates-0.10.1 lib/decidim/debates/test/factories.rb
decidim-debates-0.10.0 lib/decidim/debates/test/factories.rb
decidim-debates-0.9.3 lib/decidim/debates/test/factories.rb
decidim-debates-0.9.2 lib/decidim/debates/test/factories.rb
decidim-debates-0.9.1 lib/decidim/debates/test/factories.rb
decidim-debates-0.9.0 lib/decidim/debates/test/factories.rb