Sha256: b02c9827f3a06a8758acba6824074814b5679573b1c4f963b51f53f79ecbc113

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require "decidim/core/test/factories"

FactoryBot.define do
  factory :notify_component, parent: :component do
    name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :notify).i18n_name }
    manifest_name { :notify }
    participatory_space { create(:participatory_process, :with_steps) }
  end

  factory :notify_note, class: "Decidim::Notify::Note" do
    component { create(:notify_component) }
    body { Faker::Lorem.sentences(3).join("\n") }
    creator { create(:user) }

    trait :with_author do
      author { create(:user) }
    end

    trait :with_chapter do
      chapter { create(:notify_chapter, component: component) }
    end
  end

  factory :notify_author, class: "Decidim::Notify::Author" do
    component { create(:notify_component) }
    code { Faker::Number.between(1, 20) }
    # name { Faker::Name.name }

    trait :with_user do
      user { create(:user) }
    end

    trait :is_note_taker do
      admin { true }
    end
  end

  factory :notify_chapter, class: "Decidim::Notify::Chapter" do
    component { create(:notify_component) }
    title { Faker::Lorem.sentences(3).join("\n") }

    trait :with_user do
      user { create(:user) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-notify-0.3 lib/decidim/notify/test/factories.rb