Sha256: ea40e770fd31b558b7097c8a8d1196b3c6ae41eec3cf5eeabc8a8abaf9523845

Contents?: true

Size: 1.8 KB

Versions: 11

Compression:

Stored size: 1.8 KB

Contents

# frozen_string_literal: true

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

require "decidim/core/test/factories"
require "decidim/participatory_processes/test/factories"

FactoryBot.define do
  factory :accountability_feature, parent: :feature do
    name { Decidim::Features::Namer.new(participatory_space.organization.available_locales, :accountability).i18n_name }
    manifest_name :accountability
    participatory_space { create(:participatory_process, :with_steps, organization: organization) }
    settings do
      {
        intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) },
        categories_label: Decidim::Faker::Localized.word,
        subcategories_label: Decidim::Faker::Localized.word,
        heading_parent_level_results: Decidim::Faker::Localized.word,
        heading_leaf_level_results: Decidim::Faker::Localized.word
      }
    end
  end

  factory :status, class: "Decidim::Accountability::Status" do
    feature { create(:accountability_feature) }
    sequence(:key) { |n| "status_#{n}" }
    name { Decidim::Faker::Localized.word }
    description { Decidim::Faker::Localized.sentence(3) }
    progress { rand(1..100) }
  end

  factory :result, class: "Decidim::Accountability::Result" do
    feature { create(:accountability_feature) }
    title { Decidim::Faker::Localized.sentence(3) }
    description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
    start_date { "12/7/2017" }
    end_date { "30/9/2017" }
    status { create :status, feature: feature }
    progress { rand(1..100) }
  end

  factory :timeline_entry, class: "Decidim::Accountability::TimelineEntry" do
    result { create(:result) }
    entry_date { "12/7/2017" }
    description { Decidim::Faker::Localized.sentence(2) }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-accountability-0.10.1 lib/decidim/accountability/test/factories.rb
decidim-accountability-0.10.0 lib/decidim/accountability/test/factories.rb
decidim-accountability-0.9.3 lib/decidim/accountability/test/factories.rb
decidim-accountability-0.9.2 lib/decidim/accountability/test/factories.rb
decidim-accountability-0.9.1 lib/decidim/accountability/test/factories.rb
decidim-accountability-0.9.0 lib/decidim/accountability/test/factories.rb
decidim-accountability-0.8.4 lib/decidim/accountability/test/factories.rb
decidim-accountability-0.8.3 lib/decidim/accountability/test/factories.rb
decidim-accountability-0.8.2 lib/decidim/accountability/test/factories.rb
decidim-accountability-0.8.1 lib/decidim/accountability/test/factories.rb
decidim-accountability-0.8.0 lib/decidim/accountability/test/factories.rb