Sha256: 63b5d2690b319d4a777dac4e8d39bb1fb3302a24d5eed096e86d57d189015ca6

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require "decidim/core/test/factories"
require "decidim/consultations/test/factories"

FactoryBot.define do
  factory :delegation, class: "Decidim::ActionDelegator::Delegation" do
    setting
    granter { association :user, organization: setting.consultation.organization }
    grantee { association :user, organization: setting.consultation.organization }
  end

  factory :ponderation, class: "Decidim::ActionDelegator::Ponderation" do
    setting
    name { Faker::Lorem.sentence }
    weight { Faker::Number.between(from: 1, to: 10) }
  end

  factory :participant, class: "Decidim::ActionDelegator::Participant" do
    setting
    email { Faker::Internet.email }
    phone { Faker::PhoneNumber.phone_number }
    ponderation { setting.ponderations.first }
  end

  factory :setting, class: "Decidim::ActionDelegator::Setting" do
    max_grants { 3 }
    consultation
    trait :with_ponderations do
      after(:create) do |setting|
        create_list(:ponderation, 3, setting: setting)
      end
    end
    trait :with_participants do
      after(:create) do |setting|
        create_list(:participant, 3, setting: setting)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-action_delegator-0.8.1 lib/decidim/action_delegator/test/factories.rb
decidim-action_delegator-0.7.2 lib/decidim/action_delegator/test/factories.rb
decidim-action_delegator-0.7.1 lib/decidim/action_delegator/test/factories.rb
decidim-action_delegator-0.7.0 lib/decidim/action_delegator/test/factories.rb